Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a workbook with macros that are used to process the
contents of other workbooks. I need a test to ensure that when i run the macros the active sheet belongs to a workbook other than the one with the macros. I don't know how. Any suggestions? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Got It!
If ActiveWorkbook.Name = ThisWorkbook.Name Then MsgBox "The source worksheet is not active. Bring the source worksheet to the front and try again." Exit Sub End If -----Original Message----- I have a workbook with macros that are used to process the contents of other workbooks. I need a test to ensure that when i run the macros the active sheet belongs to a workbook other than the one with the macros. I don't know how. Any suggestions? . |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You could try the following:
Set a variable to the name of the workbook with the macros MacroWkbkNm = ActiveWorkbook.Name 'Run when macro book is active or set to something like "My Macro.xls" Then, when you are testing whether the active sheet is in the same workbook, you could only run code in another workbook by using: If ActiveWorkbook.Name < MacroWkbkNm Then 'Run code here End If -----Original Message----- I have a workbook with macros that are used to process the contents of other workbooks. I need a test to ensure that when i run the macros the active sheet belongs to a workbook other than the one with the macros. I don't know how. Any suggestions? . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
to change the macros as per active cell and range | Excel Discussion (Misc queries) | |||
Active Content/Macros | Excel Discussion (Misc queries) | |||
how to list all active macros and their assigned keystrokes? | Excel Worksheet Functions | |||
Enable check box in protected sheet + group check boxes | Excel Discussion (Misc queries) | |||
Code to check for active worksheet | Excel Programming |