in range

S

Striker

I have a spreadsheet with a lot of rows 50K, I need to do an action if
column the value in "N" is one of 8 to 14 numbers. Such as

If N.value = 1,2,3,4,5,6,7,14,121,122,123,124,201,202
then do something
else do nothing

There will be 10 of these statements, so maybe a case statement like

case 1,2,3,4,5,6,7,14,121,122,123,124,201,202
do something
case 151,152,153,154,155,156,157,214,215,216
do something


any suggestions?
 
S

Simon Lloyd

Your case statement is done like this
Code
-------------------
SUB USINGCASESTATEMENT(
[/B] SELECT CASE RANGE(\"A1\").VALU
CASE 100, 150, 200, 350, 40
RANGE(\"B1\").VALUE = RANGE(\"A1\").VALU
CASE ELS
RANGE(\"B1\").VALUE =
END SELEC
END SU
-------------------

Striker;256692 said:
I have a spreadsheet with a lot of rows 50K, I need to do an action i
column the value in "N" is one of 8 to 14 numbers. Such a

If N.value = 1,2,3,4,5,6,7,14,121,122,123,124,201,20
then do somethin
else do nothin

There will be 10 of these statements, so maybe a case statement lik

case 1,2,3,4,5,6,7,14,121,122,123,124,201,20
do somethin
case 151,152,153,154,155,156,157,214,215,21
do somethin


any suggestions

--
Simon Lloy

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com
 
B

Bernard Liengme

I think you answered the question for yourself. Here is something to play
with

Sub tryme()
For j = 1 To 5
N = InputBox("Give me a number")
Select Case N
Case 1, 2, 3, 4, 5, 6, 7, 14, 121, 122, 123, 124, 201, 202
MsgBox "first group"
Case 10, 20, 30
MsgBox "second group"
Case Else
MsgBox "not found"
End Select
Next j
End Sub

best wishes
 
Top