Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Eva Eva is offline
external usenet poster
 
Posts: 197
Default Copy down formula macro

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.


--
Greatly appreciated
Eva
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default Copy down formula macro

Hi,

In what way doesn't it work because it looks fine to me?

Mike

"Eva" wrote:

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.


--
Greatly appreciated
Eva

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Copy down formula macro

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

On Wed, 9 Dec 2009 12:51:37 -0800, Eva
wrote:

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.


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Eva Eva is offline
external usenet poster
 
Posts: 197
Default Copy down formula macro

...Hm, I don't know what I did but it works now :) thanks
--
Greatly appreciated
Eva


"Mike H" wrote:

Hi,

In what way doesn't it work because it looks fine to me?

Mike

"Eva" wrote:

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.


--
Greatly appreciated
Eva

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Use Macro to Copy Formula from one Workbook to another bevchapman Excel Discussion (Misc queries) 4 October 7th 09 03:50 PM
Do I use a formula or a macro to copy cells? ak_edm Excel Discussion (Misc queries) 3 April 7th 09 08:47 PM
Formula/ Macro that will copy and paste Randy Excel Worksheet Functions 1 August 12th 08 03:58 PM
Copy a formula down in a macro Sal Excel Discussion (Misc queries) 3 June 5th 06 02:52 AM
Formula/Macro to copy into a cell ebraun01 Excel Worksheet Functions 2 January 30th 06 01:52 PM


All times are GMT +1. The time now is 10:19 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"