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: 852
Default Run two macros for two different sheets

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
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
MACROS IN MULTIPLE SHEETS COLT45 Excel Programming 0 April 13th 09 11:53 PM
macros over different sheets Robb.rich Excel Worksheet Functions 1 May 2nd 08 11:54 AM
Hidden sheets and macros mwc0914[_18_] Excel Programming 2 July 5th 06 04:55 PM
Limiting macros to certain sheets Giselle Excel Worksheet Functions 1 January 25th 06 04:23 AM
Macros on protected sheets? Karen Brown Excel Programming 4 November 21st 03 03:53 AM


All times are GMT +1. The time now is 07:03 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"