Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
telling a macro to go back to where it came from
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
telling a macro to go back to where it came from
TRy adding this
Dim aWB as workbook Set aWB = activeworkbook 'Put this at the beginning When you want to return to the original workbook, put awb.activate " 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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
copy back macro/roll back | Excel Worksheet Functions | |||
I'm adding 1.5 & 1 and VBA is telling me its 2 ?!?! | Excel Programming | |||
Telling a website what to do!! | Excel Programming | |||
Telling a procedure to end | Excel Programming | |||
telling Excel to go down relatively | Excel Programming |