Limiting macro to a single spreadsheet

Closed
frasermac - Sep 13, 2009 at 05:39 AM
Excelguru Posts 261 Registration date Saturday April 11, 2009 Status Member Last seen June 21, 2011 - Sep 13, 2009 at 06:38 AM
Hello,
I have a simple macro which saves a spreadsheet to a memory stick for backup purposes via 'ctrl shift S'. If a second spreadsheet is opened the same ctrl shift S will save this spreadsheet to the stick and overwrite the previously saved file causing general confusion. I would like to able to link the macro to a specific spreadsheet and be sure that it only runs when activated from that spreadsheet. I hope this is possible ?

1 response

Excelguru Posts 261 Registration date Saturday April 11, 2009 Status Member Last seen June 21, 2011 307
Sep 13, 2009 at 06:38 AM
hi
just use
if activesheet.name<>"something" then exit sub
after any declarations
0