![]() |
Auto run macro on individual worksheet open
Hi all Apologies if this is elsewhere - had a look through but couldn't fin an answer but I am a newbie so please bear with me!:) I am attempting to automatically run a Macro in Excel when i open worksheet but can't find a way to do this. I know I can have one set t run when the whole workbook opens, but I need to have a different macr running when different worksheets open and each time that an individua worksheet is opened without closing down the whole workbook - basicall to return to cell A1 on open (but it may not always be A it needs to g to if that sheet is using a VLOOKUP and has numbers in the column) Thanks for any help / advice you can offe -- mr_teache ----------------------------------------------------------------------- mr_teacher's Profile: http://www.excelforum.com/member.php...fo&userid=3435 View this thread: http://www.excelforum.com/showthread.php?threadid=54124 |
Auto run macro on individual worksheet open
Right click the tab of the worksheet you want the macro to auto-run on open. Choose "View Code" VBA will open. At the top you should see "(General)" and "(Declarations)" Click on "(General)" and choose "Worksheet". "(Declarations)" will change to "SelectionChange". Click on "SelectionChange" and choose "Activate". You can then delete the following text: "Private Sub Worksheet_SelectionChange(ByVal Target As Range) End Sub" Any code you put between: "Private Sub Worksheet_Activate()" and "End Sub" will run when this particular worksheet is Activated. Hope that helps. -Ikaabod mr_teacher Wrote: Hi all Apologies if this is elsewhere - had a look through but couldn't find an answer but I am a newbie so please bear with me!:) I am attempting to automatically run a Macro in Excel when i open a worksheet but can't find a way to do this. I know I can have one set to run when the whole workbook opens, but I need to have a different macro running when different worksheets open and each time that an individual worksheet is opened without closing down the whole workbook - basically to return to cell A1 on open (but it may not always be A it needs to go to if that sheet is using a VLOOKUP and has numbers in the column) Thanks for any help / advice you can offer -- Ikaabod ------------------------------------------------------------------------ Ikaabod's Profile: http://www.excelforum.com/member.php...o&userid=33371 View this thread: http://www.excelforum.com/showthread...hreadid=541245 |
Auto run macro on individual worksheet open
Thank you so much for the reply!!! I have been trying to work out a way to do that for weeks - and have trawled through page after page of help stuff trying to find it! Thta will make life so much easier now with the programme!! Thanks again! Carl -- mr_teacher ------------------------------------------------------------------------ mr_teacher's Profile: http://www.excelforum.com/member.php...o&userid=34352 View this thread: http://www.excelforum.com/showthread...hreadid=541245 |
All times are GMT +1. The time now is 12:58 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com