Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi. I have recorded my first excel Macro. I am trying to copy/ paste
a cell down for as many rows that are in my file. However, as shown in the following code, it is making reference to cell B42, which happens to be the end of the file (i.e. End-Down) that I used to record the macro. It causes my macro to not work properly if there are a different amount of rows in my file. Each file I use will have a different amount of rows. Does anyone know what sequence of actions I should use when recording the macro -- to prevent specific cells from being referenced? Or. can someone who understands Visual Basic take a stab at correcting my code so that it will work with any amount of rows. Thanks in advance. Sub TestMacro() Range("B2").Select ActiveCell.FormulaR1C1 = "=UPPER(RC[-1])" Range("B2").Select Selection.Copy Range("A2").Select Selection.End(xlDown).Select Range("B42").Select Range(Selection, Selection.End(xlUp)).Select Range("B3:B42").Select Range("B42").Activate ActiveSheet.Paste End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Making cell reference absolute makes cell format text | Excel Worksheet Functions | |||
Recording new excel macro, relative reference button doesn't show | New Users to Excel | |||
Start relative reference macro from specific cell | Excel Programming | |||
Macro to copy text to a specific cell reference | Excel Programming | |||
Recording a macro with relative reference | Excel Programming |