Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
JAD JAD is offline
external usenet poster
 
Posts: 43
Default Cell Status Activates Macro

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 192
Default Cell Status Activates Macro

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default Cell Status Activates Macro

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default Cell Status Activates Macro

forgive me i said "he", could have been "she", should have written OP
for original poster..............
guilty as charged.
:)
susan

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Cell Status Activates Macro

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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Return cell(s) Conditional Formatting Status via a macro JudgeMental Excel Programming 3 March 15th 08 07:34 PM
VBA Code Activates a workbook only sometimes GusEvans Excel Programming 3 March 21st 06 04:27 AM
Rectangle that activates a macro No Name Excel Programming 3 January 7th 05 06:49 PM
VB activates unwanted function Urban Excel Programming 3 July 6th 04 06:59 PM
Solver activates other worksheets - why? Ken Dahlberg Excel Programming 1 September 12th 03 06:05 PM


All times are GMT +1. The time now is 02:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"