Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The following is a simplified logic statement that I am trying to write in
VB. If someone could interpret it and make it work in VB, I would appreciate it. What I am trying to do is active/run a macro whenever a specified cell shows a value of "x". Here is the incomplete statement: Sub...........Activate_Deactivate If cell A12="x" then Activate Macro named Start_Up If cell A12<"x" then Activate Macro named Hide End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I believe the following will work from your example:
Sub_Activate_Deactivate() If range("A12")="x" then Call Start_Up If range("A12")<"x" then Call Hide End Sub "JAD" wrote: The following is a simplified logic statement that I am trying to write in VB. If someone could interpret it and make it work in VB, I would appreciate it. What I am trying to do is active/run a macro whenever a specified cell shows a value of "x". Here is the incomplete statement: Sub...........Activate_Deactivate If cell A12="x" then Activate Macro named Start_Up If cell A12<"x" then Activate Macro named Hide End Sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
yes but he wants it "whenever" the cell shows the value. i believe
either worksheet_change or worksheet_calculate would be better.......... but i can't decide which one. ======================== sub worksheet_calculate() dim ws as worksheet set ws = activesheet if ws.range("a12").value = "x" then call Start_Up else call Hide end if end sub =================== :) susan On Jun 6, 3:41*pm, StumpedAgain wrote: I believe the following will work from your example: *Sub_Activate_Deactivate() *If range("A12")="x" then Call Start_Up *If range("A12")<"x" then Call Hide *End Sub "JAD" wrote: The following is a simplified logic statement that I am trying to write in VB. If someone could interpret it and make it work in VB, I would appreciate it. What I am trying to do is active/run a macro whenever a specified cell shows a value of "x". Here is the incomplete statement: Sub...........Activate_Deactivate If cell A12="x" then Activate Macro named Start_Up If cell A12<"x" then Activate Macro named Hide End Sub- Hide quoted text - - Show quoted text - |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Since you are basing your criteria in a cell, the Worksheet_Change would
probably work better that using the Activate and Deactivate events. This would go into the Worksheet code module for the Sheet with Range("A12") criteria. Right click the sheet tab, click View Code and paste this into the code window. Private Sub Worksheet_Change(ByVal Target As Range) If Target = Range("A12") Then If LCase(Target) = "x" Then Start_Up ElseIf LCase(Target) < "x" Then Hide End If End If End Sub "JAD" wrote: The following is a simplified logic statement that I am trying to write in VB. If someone could interpret it and make it work in VB, I would appreciate it. What I am trying to do is active/run a macro whenever a specified cell shows a value of "x". Here is the incomplete statement: Sub...........Activate_Deactivate If cell A12="x" then Activate Macro named Start_Up If cell A12<"x" then Activate Macro named Hide End Sub |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
forgive me i said "he", could have been "she", should have written OP
for original poster.............. guilty as charged. :) susan |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Return cell(s) Conditional Formatting Status via a macro | Excel Programming | |||
VBA Code Activates a workbook only sometimes | Excel Programming | |||
Rectangle that activates a macro | Excel Programming | |||
VB activates unwanted function | Excel Programming | |||
Solver activates other worksheets - why? | Excel Programming |