Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have to convert many accounts to a new account string. I have many
Or's. Is there a better way to code this? ( I actually have 16 Or's- I only show 4 for the example): For Each cll In Selection old = Right(cll, 4) If old = "0101" Or old = "0102" Or old = "0103" Or old = "0104" Then CONVERT CLL End If Next Thanks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Not really a whole lot of information to go on. But, I would most
likely use a Select Case statement Select Case old Case "0101" whatever goes here Case "0102" something else goes here End Select You can include a Case Else statement at the end of the Case statements if you need to. snax500 wrote: I have to convert many accounts to a new account string. I have many Or's. Is there a better way to code this? ( I actually have 16 Or's- I only show 4 for the example): For Each cll In Selection old = Right(cll, 4) If old = "0101" Or old = "0102" Or old = "0103" Or old = "0104" Then CONVERT CLL End If Next Thanks |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
For Each cll In Selection
Select Case Right(cll, 4) Case "0101","0102" ,"0103", "0104" 'you might get away with Case "0101" to "0104" here but needs testing CONVERT CLL Case 'another list Case 'yet another list Do something Case Else Only do something here if none of the others above have triggered End Select Next -- p45cal "snax500" wrote: I have to convert many accounts to a new account string. I have many Or's. Is there a better way to code this? ( I actually have 16 Or's- I only show 4 for the example): For Each cll In Selection old = Right(cll, 4) If old = "0101" Or old = "0102" Or old = "0103" Or old = "0104" Then CONVERT CLL End If Next Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Multiple IF's with an OR | Excel Worksheet Functions | |||
Multiple IF's to Select a Value | Excel Worksheet Functions | |||
Multiple If's and OR's | Excel Worksheet Functions | |||
multiple IF's ? | Excel Worksheet Functions | |||
Formula with multiple IF'S | Excel Discussion (Misc queries) |