virgilgarcia
New Member
- Joined
- May 23, 2011
- Messages
- 10
Hi all,
I currently have a macro that is applicable to the current workbook. Is there a way for me to generalize this macro so that I can access it and make it work from practically any workbook by using the same shortcut key (perhaps storing it in the "Personal" file)?
the macro looks like this: (Credits to Tom Urtis)
Sub PrintRelevant()
Dim cell As Range
For Each cell In Sheets("Print").Columns(1).SpecialCells(2)
Sheets(cell.Value).PrintOut
Next cell
End Sub
The above macro prints the sheets whose names are stored in column 1 of the "Print" tab.
One issue that I encountered is that if I have multiple workbooks open at the same time, the macro is activated for all open workbooks. Is there a way for me to modify this macro so that it would only activate for the currently open workbook only?
Thanks in advance,
Virgil
I currently have a macro that is applicable to the current workbook. Is there a way for me to generalize this macro so that I can access it and make it work from practically any workbook by using the same shortcut key (perhaps storing it in the "Personal" file)?
the macro looks like this: (Credits to Tom Urtis)
Sub PrintRelevant()
Dim cell As Range
For Each cell In Sheets("Print").Columns(1).SpecialCells(2)
Sheets(cell.Value).PrintOut
Next cell
End Sub
The above macro prints the sheets whose names are stored in column 1 of the "Print" tab.
One issue that I encountered is that if I have multiple workbooks open at the same time, the macro is activated for all open workbooks. Is there a way for me to modify this macro so that it would only activate for the currently open workbook only?
Thanks in advance,
Virgil