Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Load VBA on Activated Sheet

Hey,
in Visual basic you can put in code to run when the form is loaded up.

is there a way to do the same for Excel when a worksheet is loaded up?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Load VBA on Activated Sheet

What you are looking for is event driven programming and the answer is yes.
On the worksheet you want to run the code... Right Click the Tab and select
View Code. Just above the code window in the left had drop down box (General)
select Worksheet. the drop down on the Right will give you all of the Events
you can program against. You are looking for Activate. When you select the
event a code stub will be added for you...
--
HTH...

Jim Thomlinson


"RigasMinho" wrote:

Hey,
in Visual basic you can put in code to run when the form is loaded up.

is there a way to do the same for Excel when a worksheet is loaded up?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Load VBA on Activated Sheet

Private Sub Worksheet_Activate()
'do something
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"RigasMinho" wrote in message
oups.com...
Hey,
in Visual basic you can put in code to run when the form is loaded up.

is there a way to do the same for Excel when a worksheet is loaded up?



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
Warehouse load sheet - Help!! Jamie Excel Discussion (Misc queries) 0 July 1st 08 02:31 PM
Error sheet when macro's are not activated jgmiddel Excel Programming 0 March 22nd 06 09:28 PM
Can I Somehow load a Spread Sheet thru a Scanner murashid Excel Worksheet Functions 1 August 18th 05 01:11 PM
Load an array with Sheet names S G Booth Excel Programming 6 March 2nd 05 08:48 PM
VBA - Left Shift to be Activated when Sheet is selected. BradWarr Excel Programming 1 June 22nd 04 01:25 PM


All times are GMT +1. The time now is 03:48 AM.

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

About Us

"It's about Microsoft Excel"