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? |
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. |
All times are GMT +1. The time now is 11:39 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com