PC Review


Reply
Thread Tools Rate Thread

Cell Status Activates Macro

 
 
JAD
Guest
Posts: n/a
 
      6th Jun 2008
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

 
Reply With Quote
 
 
 
 
StumpedAgain
Guest
Posts: n/a
 
      6th Jun 2008
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
>

 
Reply With Quote
 
Susan
Guest
Posts: n/a
 
      6th Jun 2008
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
<StumpedAg...@discussions.microsoft.com> 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 -


 
Reply With Quote
 
JLGWhiz
Guest
Posts: n/a
 
      6th Jun 2008
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
>

 
Reply With Quote
 
Susan
Guest
Posts: n/a
 
      6th Jun 2008
forgive me i said "he", could have been "she", should have written OP
for original poster..............
guilty as charged.

susan

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Return cell(s) Conditional Formatting Status via a macro JudgeMental Microsoft Excel Programming 3 15th Mar 2008 07:34 PM
Rectangle that activates a macro Microsoft Excel Programming 3 7th Jan 2005 06:52 PM
determining macro status in a cell newengland Microsoft Excel Misc 2 10th Feb 2004 12:54 AM
listbox macro activates during save as barberjo Microsoft Excel Misc 0 3rd Oct 2003 11:26 PM
Status bar for macro Kevin G Microsoft Excel Programming 0 17th Sep 2003 03:45 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:57 AM.