Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
HI,
can i have ore then 1 "Worksheet_Change" sub? i.e I havea sub, Private Sub Worksheet_Change but, Private Sub Worksheet2_Change will not work -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200912/1 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
No. but you can combine. As ALWAYS, post your code for comments.
-- Don Guillett Microsoft MVP Excel SalesAid Software "FIRSTROUNDKO via OfficeKB.com" <u15639@uwe wrote in message news:9ff261acc54dc@uwe... HI, can i have ore then 1 "Worksheet_Change" sub? i.e I havea sub, Private Sub Worksheet_Change but, Private Sub Worksheet2_Change will not work -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200912/1 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Not fot the same sheet. However, you can have the worksheet change do more
than one thing by using If...Then statements. For example: Private Sub Worksheet_Change(ByVal Target As Range) Dim sh As Worksheet Set sh = ActiveSheet If sh.Range("A1").Value 0 Then 'Do one thing End If If sh.Target.Value = "Do Something" Then 'Do another End If If Not Intersect(sh.Selection, Target) Is Nothing Then "Do somethiing else End If End Sub Only when the If statement is true will the code execute a command to do something. If none of them are true then it executes no commands. If all of them are true it executes all three commands. "FIRSTROUNDKO via OfficeKB.com" <u15639@uwe wrote in message news:9ff261acc54dc@uwe... HI, can i have ore then 1 "Worksheet_Change" sub? i.e I havea sub, Private Sub Worksheet_Change but, Private Sub Worksheet2_Change will not work -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200912/1 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
No, you will just have to combine the code you want in your two Change
events into the Change event that VB provides. You can use If..Then blocks to separate the functionality you wanted in your proposed separate Change events. -- Rick (MVP - Excel) "FIRSTROUNDKO via OfficeKB.com" <u15639@uwe wrote in message news:9ff261acc54dc@uwe... HI, can i have ore then 1 "Worksheet_Change" sub? i.e I havea sub, Private Sub Worksheet_Change but, Private Sub Worksheet2_Change will not work -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200912/1 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Private Sub Worksheet_Change code not robust enough | Excel Programming | |||
Private Sub Worksheet_change ... Procedures jamming up | Excel Programming | |||
Private Sub Worksheet_Change doesn't work? | Excel Programming | |||
Private Sub Worksheet_Change(ByVal Target As Range) | Excel Programming | |||
Private Sub Worksheet_Change(ByVal Target As Range) | Excel Programming |