Copy down formula macro

E

Eva

Hi
I have this macro that doesn't work and I am not sure why:

LastRow = Sheets("Sheet1").Range("D" & Rows.Count).End(xlUp).Row
Sheets("Sheet1").Range("P2:q2").Copy _
Destination:=Sheets("Sheet1").Range("P3:Q" & LastRow)
Calculate

Macro should check how many rows are in column D and then copy the formula
form P2:Q2 down to the last row.
 
G

Gord Dibben

Certainly works for me.

What does it not do for you?

Add a message box after this line

LastRow = Sheets("Sheet1").Range("D" & Rows.Count).End(xlUp).Row

msgbox Lastrow

What number is returned?


Gord Dibben MS Excel MVP
 

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