Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto Open Macro Launchnet Excel Worksheet Functions 7 July 20th 07 07:41 PM
Auto log off a user with a worksheet open? Sailonmike Excel Discussion (Misc queries) 1 February 1st 07 07:06 PM
Auto Open Macro Kasey Kern Excel Programming 3 November 30th 05 08:30 PM
open up an excel program with an auto open macro [email protected] Excel Programming 2 July 17th 05 04:48 PM
how to auto increment a number each time i open the worksheet fred rondak Excel Worksheet Functions 1 June 25th 05 11:40 PM


All times are GMT +1. The time now is 02:10 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"