Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi Russ,
Your recorded line Range("A1:AO297").Select will select that range all the time. If you want to select a dynamic range, select cell A1 and use the keyboard press Ctrl and the * (this is Ctrl Shift 8 on the keyboard). If you record this command, it will select the active range around A1. -- Hope this helps, MarkN "Russ Tarafdar" wrote: I am new to using macros. I have worksheet which will have different numbers of rows of data from one month to the next. I am taking data that has been copied from a browse of the main frame and need to format it to be copied into a reconciliation worksheet. The problem I am running into in recording the macro is that it ends up hardcoding the range when I select all. A test macro I created for this part of the functionality follows: Sub test() ' ' test Macro ' Macro recorded 6/22/2006 by ABC ' ' Columns("C:C").Select Selection.Cut Columns("B:B").Select Selection.Insert Shift:=xlToRight Columns("C:C").Select Selection.Insert Shift:=xlToRight Range("C1").Select ActiveCell.FormulaR1C1 = "abc" Columns("F:F").Select Selection.Insert Shift:=xlToRight Range("F1").Select ActiveCell.FormulaR1C1 = "def" Range("A1:AO297").Select Range("F1").Activate Selection.Replace What:="", Replacement:="filler", LookAt:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False Range("C2").Select ActiveCell.FormulaR1C1 = "CODA" Range(Selection, Selection.End(xlDown)).Select Selection.FillDown End Sub Please indicate which lines of code need to be deleted and where to insert the recommended change. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Running of Worksheet Change Macro breaks undo functionality. | Excel Discussion (Misc queries) | |||
checking that cells have a value before the workbook will close | Excel Worksheet Functions | |||
Macro to search for and display data in another worksheet | Excel Worksheet Functions | |||
embedding worksheet cells in another worksheet | Excel Discussion (Misc queries) | |||
select worksheet to run macro | Excel Discussion (Misc queries) |