ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Limiting macros to certain sheets (https://www.excelbanter.com/excel-worksheet-functions/67232-limiting-macros-certain-sheets.html)

Giselle

Limiting macros to certain sheets
 
Hi
Newbie question, I think

I have some macros in my workbook that are activated by <ctrl<shiftA,
<ctrl<shiftB, <ctrl<shiftC, etc. My prob is that they work on EVERY
sheet, but i'd like them to work only on certain designated sheets. Any
ideas how to go about this?

Merci
Giselle



Paul B

Limiting macros to certain sheets
 
Giselle, you could check for the sheet name like this,

Sub test()
If ActiveSheet.Name = "Sheet2" Then
'Your Code here
Else
Exit Sub
End If
End Sub



--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"Giselle" wrote in message
...
Hi
Newbie question, I think

I have some macros in my workbook that are activated by <ctrl<shiftA,
<ctrl<shiftB, <ctrl<shiftC, etc. My prob is that they work on EVERY
sheet, but i'd like them to work only on certain designated sheets. Any
ideas how to go about this?

Merci
Giselle






All times are GMT +1. The time now is 08:15 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com