Need help with Excel VB

P

programmernovice

Hi, is there some macro command in Excel VB with is triggered when a
given worksheet is opened? If so what's the syntax? Many thanks in
advance.
 
D

Damon Longworth

There is a workbook open event in which any code can be triggered when the
workbook is opened.

Right click on the Excel icon next to the File menu - View code - Select
Workbook in the drop down menu containing General.

--

Damon Longworth

2007 East Coast Excel / Access User Conference
April 18-20, 2007 - Providing Microsoft Excel training and Microsoft Excel
Classes
Atlantic City, New Jersey
www.ExcelUserConference.com/ECEUC.html

Hi, is there some macro command in Excel VB with is triggered when a
given worksheet is opened? If so what's the syntax? Many thanks in
advance.
 
P

Per Erik Midtrød

Yes there is and it is called an event.
Right-click the sheet, select view code and insert something like:

Private Sub Worksheet_Activate()
MsgBox ("Hello world")
End Sub

Per Erik
 
G

Gord Dibben

Private Sub Worksheet_Activate()
'do your stuff
End Sub


Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top