Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to write VB code to cause a Macro to run when a particular
worksheet is selected. How do I write this code and where do I place it? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to write VB code to cause a Macro to run when a particular
worksheet is selected. How do I write this code and where do I place it? The code is the same as any other VB code... whatever you need it to do. You place it in the worksheet's code mudule... In the VB window, press View-Project Explorer Double click the sheet that you want the code to work with Use the drop box in the upper left and select 'Worksheet' Use the drop box in the upper right to select 'Activate' When you do that, a subroutine will come up that looks like this: Private Sub Worksheet_SelectionChange(ByVal Target As Range) End Sub Each time the sheet is activated, that code will run. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Think Mark copied the wrong event declaration:
Private Sub Worksheet_Activate() End Sub is what he describes. -- Regards, Tom Ogilvy "mark" wrote in message ... I am trying to write VB code to cause a Macro to run when a particular worksheet is selected. How do I write this code and where do I place it? The code is the same as any other VB code... whatever you need it to do. You place it in the worksheet's code mudule... In the VB window, press View-Project Explorer Double click the sheet that you want the code to work with Use the drop box in the upper left and select 'Worksheet' Use the drop box in the upper right to select 'Activate' When you do that, a subroutine will come up that looks like this: Private Sub Worksheet_SelectionChange(ByVal Target As Range) End Sub Each time the sheet is activated, that code will run. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Think Mark copied the wrong event declaration:
Yep, I sure did. Thanks for the catch. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Write macro to lock selected sheet when run | Excel Discussion (Misc queries) | |||
how do i write a macro to move down in the sheet one line ? | New Users to Excel | |||
is it possible to execute write to the fields in another .xsl form a macro in another .xsl? e.g. some way to load another .xsl into an .xsl macro and write to its data? | Excel Worksheet Functions | |||
How do I write a macro copies a column to another sheet but that . | Excel Programming | |||
how to allow macro to write on a protected sheet | Excel Programming |