Hi there,
Is there any way to add a "worksheet activate" event to a sheet by using VBA code?
I have a macro in which I create a new sheet and want to add a "worksheet activate" event to it.
Thanks in advance for any help!
js
Hi there,
Is there any way to add a "worksheet activate" event to a sheet by using VBA code?
I have a macro in which I create a new sheet and want to add a "worksheet activate" event to it.
Thanks in advance for any help!
js
Last edited by js8765; 03-05-2010 at 10:56 AM.
Is the event code the same for each sheet that you add?
Everyone who confuses correlation and causation ends up dead.
This is probably worth a look: http://www.cpearson.com/excel/vbe.aspx
Dom
"May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."
Use code tags when posting your VBA code: [code] Your code here [/code]
Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.
Hi again,
Well...the event code will be the same for each sheet I create using the sub.
Basically the sub has to add one sheet and then add the event code just to that sheet...
Cheers,
js
If you use the Workbook_SheetActivate event instead it will fire for all sheets in the workbook but you can tell it not to do anything if the sheet has a particular name. That means that you wouldn't need to add any code to the sheets as you create them - the event will work for them automatically.
OK.
Thank you both for the ideas. I found some code that should do the trick in the link Dom sent under the section "Adding A Procedure To A Module"
Cheers,
js
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks