Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 516
Default Programming of alternative actions in VB macros

Need help. I want a macro to run two alternative actions (not cell entries in
the worksheet) under the condition that in an Excel cell the entry is 1 or 0.
Can I write something like: if(cell=1, than jump to macro line 10, otherwise
jump to macro line 20)? What would be the syntax?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default Programming of alternative actions in VB macros

Hi

Sub test()
Select Case Sheets(1).Range("A1").Value
Case 0
MsgBox "Here's zero"
MsgBox "Not much, that"
Case 1
MsgBox "There's a one in there !"
MsgBox "we won"
Case Else
MsgBox "Nonsense in A1"
End Select
End Sub

HTH. Best wishes Harald

"Matt" skrev i melding
...
Need help. I want a macro to run two alternative actions (not cell entries

in
the worksheet) under the condition that in an Excel cell the entry is 1 or

0.
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
Excel 2007-programming macros that apply to data validation Derek Megyesi New Users to Excel 1 January 31st 10 10:11 PM
Hep with Conditionals actions please. Mark Excel Worksheet Functions 2 February 8th 09 04:02 PM
Request for Learning Macros and their Programming for Begginners Ahmed Bawazir Excel Discussion (Misc queries) 1 November 13th 08 09:15 AM
How to perform two actions ? morph000 Excel Worksheet Functions 5 January 22nd 06 02:13 AM
Help Programming Macros Tony Law[_2_] Excel Programming 0 July 30th 03 03:08 PM


All times are GMT +1. The time now is 08:10 AM.

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

About Us

"It's about Microsoft Excel"