Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-08-2008, 03:00 AM
Junior Member
 
Join Date: Oct 2007
Posts: 6
iTrader: (0)
Juggler is on a distinguished road
Default Selections

I am looking for a better way to use an IF statement then using something like:
"if intAdmin = 1 or intAdmin = 2 or intAdmin = 3......... then"
How can I make the if statement look for 8 different numbers without using all those "OR"s?
Thanks in advance.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-14-2008, 08:08 AM
Member
 
Join Date: Oct 2007
Posts: 41
iTrader: (0)
TonyES is on a distinguished road
Default

In VBA, you can use Select Case:

Select Case intAdmin
Case 1 To 5, 12, 37
' some code here
...
Case 6, 9 To 11
' some other code here
...
Case Else ' all other values
' more code
...
End Select
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-14-2008, 10:44 AM
Junior Member
 
Join Date: Oct 2007
Posts: 6
iTrader: (0)
Juggler is on a distinguished road
Default

Great Tony.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -6. The time now is 03:43 AM.