Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
What would be the correct coding syntax for the following:
If a = x then (instructions) or If b = x then (instructions) or If c = x then (instructions) or If d = x then (instructions) or If e = x then (instructions) or If f = x then (instructions) Endif Any help would be appreciated, Ed |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Sat, 20 Jan 2007 07:11:27 -0600, Ed wrote:
What would be the correct coding syntax for the following: If a = x then (instructions) or If b = x then (instructions) or If c = x then (instructions) or If d = x then (instructions) or If e = x then (instructions) or If f = x then (instructions) Endif Any help would be appreciated, Ed I'm having a little problem understanding your question. In other words, what do you expect to happen if both b and e = x. Assuming you just want to execute different instructions after the first occurrence, you could use the If...Then...Else Statement If a=x Then [instructions] [ElseIf b=x Then [instructions] [ElseIf b=x Then [instructions] .... End If (Look up IF in VBA help) However, if you want to execute instructions if any of a-f = x, then you could use the OR operator: IF _ a = x _ OR b = x _ OR c = x _ ... _ Then [instructions] End If Depending on the nature of the data, there may be other ways of executing this test. --ron |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
An addenda to Rosenfeld's reply:
If a-f are mutually exclusive, you may want to use a Select Case Statement, which you can find in Help. Hth, Merjet |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I would use a Select Case statement. E.g.,
Select Case X Case A ' do something Case B ' something else Case C ' something ' and so on Case Else ' in case no match is found above End Select -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com (email address is on the web site) "Ed" wrote in message ... What would be the correct coding syntax for the following: If a = x then (instructions) or If b = x then (instructions) or If c = x then (instructions) or If d = x then (instructions) or If e = x then (instructions) or If f = x then (instructions) Endif Any help would be appreciated, Ed |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you all. Decided to use case.
Thanks again, Ed On Sat, 20 Jan 2007 07:11:27 -0600, Ed wrote: What would be the correct coding syntax for the following: If a = x then (instructions) or If b = x then (instructions) or If c = x then (instructions) or If d = x then (instructions) or If e = x then (instructions) or If f = x then (instructions) Endif Any help would be appreciated, Ed |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
about & operator | Excel Discussion (Misc queries) | |||
Operator | Excel Worksheet Functions | |||
what does ~ operator mean? | Excel Discussion (Misc queries) | |||
Mod operator | Excel Programming | |||
Like Operator | Excel Programming |