LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Macro Help to Copy to Last Cell

Hello,

I created a macro using the recorder that is used to copy
a formula down to the last cell in a worksheet. Below is
the code for this macro:
Sub CopyFormula()
'
' CopyFormula Macro
' Macro recorded 6/30/2004 by dy
'
Range("G2").Select
Selection.Copy
Range("E3:G3").Select
Range("G3").Activate
Range(Selection, Selection.End(xlDown)).Select
Range("G3:G215").Select
ActiveSheet.Paste
Application.CutCopyMode = False
End Sub

The problem is in the code statement of Range("G3:G215");
this was created when I recorded the macro which worked
today because G215 is currently the last cell. Tomorrow
when I paste new data into the worksheet there will be
more data which will obviously create the need to use more
rows beyond G215. My macro, as it stands, will only copy
down to G215 unless I manually change the range in the
code. How can I change this recorded code to know to copy
down to the current last cell automatically (dynamically)
so that the formula will get copied to the the last needed
cell? Any help will be greatly appreciated. Thank you.
Dave Y
 
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
How do I copy a macro into another cell? Jango53 Excel Discussion (Misc queries) 0 September 2nd 08 10:05 PM
Is there a macro i can use to copy a cell +1 Bill M. Excel Discussion (Misc queries) 4 February 12th 08 02:59 PM
Want to use a Macro to copy and paste cell *value* only HeadRusch Excel Discussion (Misc queries) 1 May 11th 07 11:06 PM
Using macro to copy a part of a cell content to next cell Charles Excel Discussion (Misc queries) 6 May 31st 06 05:57 AM
Macro help - copy a cell down gjcase Excel Discussion (Misc queries) 3 September 4th 05 05:09 AM


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

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

About Us

"It's about Microsoft Excel"