Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Both codes in a standard module at present.
If I run the first one for sheet 1, I want to run the second one for sheet 2. Calling the second code from the first does not work. Strange to me?? I have also tried to combine both in a single macro using With Sheets(Sheet2) / End With to get the code to do its job on sheet 2, but no go. End goal is to have them in a worksheet change event macro so when sheet 1 is changed sheet 2 is also changed. Thanks. Howard Sub TopToBottom_A() '/ Moves A1 Dim LastRow As Long LastRow = Sheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Row Application.ScreenUpdating = False Cells(1, 1).Cut Cells(Rows.Count, "A").End(xlUp)(2) Range("A2").Resize(LastRow, 2).Cut Cells(1, 1) Application.ScreenUpdating = True End Sub Sub TopToBottom_AB() '/ Moves A1 & B1 Dim LastRow As Long LastRow = Sheets("Sheet2").Cells(Rows.Count, "B").End(xlUp).Row Application.ScreenUpdating = False Cells(1, 1).Resize(1, 2).Cut Cells(Rows.Count, "A").End(xlUp)(2) Range("A2").Resize(LastRow, 2).Cut Cells(1, 1) Application.ScreenUpdating = True End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
MACROS IN MULTIPLE SHEETS | Excel Programming | |||
macros over different sheets | Excel Worksheet Functions | |||
Hidden sheets and macros | Excel Programming | |||
Limiting macros to certain sheets | Excel Worksheet Functions | |||
Macros on protected sheets? | Excel Programming |