#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default in range

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?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default in range


Your case statement is done like this:
Code:
--------------------
SUB USINGCASESTATEMENT()
[/b] SELECT CASE RANGE(\"A1\").VALUE
CASE 100, 150, 200, 350, 400
RANGE(\"B1\").VALUE = RANGE(\"A1\").VALUE
CASE ELSE
RANGE(\"B1\").VALUE = 0
END SELECT
[b]END SUB
--------------------


Striker;256692 Wrote:
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?



--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=71653

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,104
Default in range

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
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Striker" wrote in message
...
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?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I enter formula sum(range+range)*0.15 sumif(range=3) tkw Excel Discussion (Misc queries) 2 October 1st 09 09:17 PM
Excel Addin:Setting the range to the Excel.Range object range prop Rp007 Excel Worksheet Functions 5 November 24th 06 04:30 PM
Range Question / error 1004: method Range of object Worksheet has failed Paul Excel Programming 3 April 7th 05 02:56 PM
Range.Find returns cell outside of range when range set to single cell Frank Jones Excel Programming 12 June 10th 04 04:22 AM
how to? set my range= my UDF argument (range vs. value in range) [advanced?] Keith R[_3_] Excel Programming 2 August 11th 03 05:55 PM


All times are GMT +1. The time now is 08:49 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"