ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Code for Work Sheet (https://www.excelbanter.com/excel-programming/387129-code-work-sheet.html)

Guye

Code for Work Sheet
 
Hi,
I have written 2 seperate codes for 2 different worksheets.
and i would like to apply each of them only on the relevant worksheet,
both codes a

Private Sub Worksheet_Activate

how can i apply each code only for 1 worksheet ?

thanks


NickHK

Code for Work Sheet
 
Assuming that each routine is on the code module for its respective WS, it
will run when that WS is activated.
It is not affected by code on other WS's.

NickHK

"Guye" wrote in message
ups.com...
Hi,
I have written 2 seperate codes for 2 different worksheets.
and i would like to apply each of them only on the relevant worksheet,
both codes a

Private Sub Worksheet_Activate

how can i apply each code only for 1 worksheet ?

thanks




Bob Phillips

Code for Work Sheet
 
As long as you Worksheet_Activate in the appropriate worksheet code modules,
and not Workbook_SheetACtivate in ThisWorkbook code module, they will only
act upon the activation of that single sheet, and will not interfere with
each other (unless your code triggers the other of course).

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Guye" wrote in message
ups.com...
Hi,
I have written 2 seperate codes for 2 different worksheets.
and i would like to apply each of them only on the relevant worksheet,
both codes a

Private Sub Worksheet_Activate

how can i apply each code only for 1 worksheet ?

thanks




Mike Fogleman

Code for Work Sheet
 
Right-click the worksheet tab and select "View Code". This will open the
code module for that worksheet only. Above the code area are 2 drop-down
arrows General & Declarations. Click on General arrow and select Worksheet.
Now the right down arrow will give a list of Worksheet Events you can write
code for.

Mike F
"Guye" wrote in message
ups.com...
Hi,
I have written 2 seperate codes for 2 different worksheets.
and i would like to apply each of them only on the relevant worksheet,
both codes a

Private Sub Worksheet_Activate

how can i apply each code only for 1 worksheet ?

thanks





All times are GMT +1. The time now is 09:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com