Copy function down column in vba

J

Jennifer

Hi there,
I am using the following code when the user hits the enter button on a form.
As you can see values from the various txt boxes, cbo boxes etc. are put into
the 1st blank row at the bottom of the database. What i need now is to know
how to copy the formula in column 7 from the row above, down to be even with
all the data that was just entered. Hope this is clear.

Private Sub cmdAdd_Click()
ActiveWorkbook.Sheets("Sheet3").Activate
'stops flickering
Application.ScreenUpdating = False
Set ws = Worksheets("Database")
iRow = ws.Cells(Rows.Count, 2).End(xlUp).Row + 1
ws.Cells(iRow, 1).Value = "N/A"
ws.Cells(iRow, 6).Value = Me.Calendar1
ws.Cells(iRow, 4).Value = Me.txtPounds.Value
ws.Cells(iRow, 2).Value = Me.cboIngredient.Value
ws.Cells(iRow, 5).Value = "Actual"
ws.Cells(iRow, 7).value = ?????????????
Me.ListBox1.Value = Update
 
G

Gary Keramidas

i'm no sure what you're trying to do

maybe

ws.Cells(irow - 1, 7).Copy
ws.Cells(irow, 7).PasteSpecial xlPasteFormulas
 
J

Jennifer

Ya that worked - - brain fart there. Thanks pretty easy!
How do you get the highlighted copied area to stop flashing on the
worksheet? I always have this problem when I try and copy formulas in VBA
into a worksheet. Thanks again. Jennifer
--
Thank you,

Jennifer


Gary Keramidas said:
i'm no sure what you're trying to do

maybe

ws.Cells(irow - 1, 7).Copy
ws.Cells(irow, 7).PasteSpecial xlPasteFormulas
 
G

Gary Keramidas

application.CutCopyMode = false

should do it

--

Gary


Jennifer said:
Ya that worked - - brain fart there. Thanks pretty easy!
How do you get the highlighted copied area to stop flashing on the
worksheet? I always have this problem when I try and copy formulas in VBA
into a worksheet. Thanks again. Jennifer
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top