Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I copy a macro into another cell? | Excel Discussion (Misc queries) | |||
Is there a macro i can use to copy a cell +1 | Excel Discussion (Misc queries) | |||
Want to use a Macro to copy and paste cell *value* only | Excel Discussion (Misc queries) | |||
Using macro to copy a part of a cell content to next cell | Excel Discussion (Misc queries) | |||
Macro help - copy a cell down | Excel Discussion (Misc queries) |