telling a macro to go back to where it came from
Add this:
Dim MySheet as string
Dim MyCell as string
At the beginning of your macro, add:
MySheet=activesheet.name
MyCell=activecell.address
[your macro here...]
At the end of your macro add
Sheets(MySheet).activate
Range(MyCell).select
On Apr 6, 3:17 pm, wrote:
How can I modify this so that Excel will go back to the workbook it
came from? This macro goes from "company financials" over to my macro
sheet "Formatting Macros.xls". I want to use it for others like
"Division 1.xls" and "Division 2.xls", etc. so I need some way of
telling it to just go back to where it started. Please help.
Windows("FORMATTING MACROS.xls").Activate
Application.Run Range("ScOnWindow")
Range("N6").Select
Selection.Copy
Windows("COMPANY FINANCIALS.xls").Activate
Application.Run Range("ScOnWindow")
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
|