Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default start macro based on result

excel 2000

I need to automatically start one of four macros that prints different items
based on the results in a specific cell.

basically if C7 = 2 run macro1
if C7 = 3 run macro2
if C7 = 4 run macro3
if C7 = 5 run macro4

Any help would be greatly appreciated. Thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default start macro based on result

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("C7")) Is Nothing Then
With Target
If .Value = 2 Then
Macro1
ElseIf .Value = 3 Then
Macro2
ElseIf .Value = 4 Then
Macro3
ElseIf .Value = 5 Then
Macro4
End If
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub


'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Truseeker" wrote in message
...
excel 2000

I need to automatically start one of four macros that prints different

items
based on the results in a specific cell.

basically if C7 = 2 run macro1
if C7 = 3 run macro2
if C7 = 4 run macro3
if C7 = 5 run macro4

Any help would be greatly appreciated. Thanks




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
Conditional Formating based on start and end dates Dave Excel Discussion (Misc queries) 1 March 31st 10 01:26 PM
start a macro or procedure based on user putting an x in a cell mathew Excel Discussion (Misc queries) 0 August 17th 06 06:21 PM
Calculate Start Dates based on Need-By Date? GB Excel Worksheet Functions 2 February 21st 06 06:11 PM
vlookup based on random result returns incorrect result rickat Excel Worksheet Functions 1 December 6th 05 01:16 PM
Can't start Excel based on File Type Stuart Excel Discussion (Misc queries) 7 October 21st 05 07:17 PM


All times are GMT +1. The time now is 12:41 PM.

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"