Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default autorun code when opening sheet (not workbook)

H

I have a code that I want to use... but automaticalled when one enters a sheet. How do i do this

For instanc

If i click on "sheet2
Sheet 2 opens u

I want it so that If i click on sheet2 (open sheet2
that a code of my choosing will automatically run for that sheet

Thanks
Steve Mutambo
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default autorun code when opening sheet (not workbook)

Steve,

Use the Activate event of the worksheet. Right click on the sheet
tab and choose View Code. In the code module that opens up, use

Private Sub Worksheet_Activate()
' your code here
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Steve Mutambo" wrote in
message
...
Hi

I have a code that I want to use... but automaticalled when one

enters a sheet. How do i do this?

For instance

If i click on "sheet2"
Sheet 2 opens up

I want it so that If i click on sheet2 (open sheet2)
that a code of my choosing will automatically run for that

sheet.

Thanks,
Steve Mutambo



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default autorun code when opening sheet (not workbook)

Steve,

you need to put your code in the Activate event of the
worksheet. To do this from the VBE, double click on the
relevant sheet in the Project Explorer window,
select "Worksheet" from the first dropdown and "Activate"
from the second.

Insert the required code.

Cheers, Pete.


-----Original Message-----
Hi

I have a code that I want to use... but automaticalled

when one enters a sheet. How do i do this?

For instance

If i click on "sheet2"
Sheet 2 opens up

I want it so that If i click on sheet2 (open sheet2)
that a code of my choosing will automatically run for

that sheet.

Thanks,
Steve Mutambo
.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default autorun code when opening sheet (not workbook)

You the man Chi
You the man
Thanks
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
Code for opening a workbook at a specific time!?! mike_vr Excel Discussion (Misc queries) 2 June 5th 07 04:55 PM
Executing code with opening target workbook Todd Huttenstine[_3_] Excel Programming 1 December 26th 03 02:00 AM
Performing code without opening the Workbook Marishah Warren Excel Programming 2 December 25th 03 10:04 AM
Code for Opening a Closed Workbook scrabtree23[_2_] Excel Programming 3 November 11th 03 03:48 PM
Autorun macro on opening spreadsheet simonjackson79 Excel Programming 3 November 5th 03 02:22 PM


All times are GMT +1. The time now is 06:14 PM.

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"