LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 573
Default number not a number?


Peter T wrote:
I didn't see you already have three abswers when I posted!

slight correction -

Your Case evaluates the expression (rnum = 11) which inevitably will

return
False, and False < 11


not 'inevitably', but a boolean or error

Regards,
Peter T

"Peter T" <peter_t@discussions wrote in message
...
Your Case evaluates the expression (rnum = 11) which inevitably will

return
False, and False < 11

Select Case rnum
Case 11 ' etc
End Select

In passing this line
Set rNumber = ws.Range(rstartcell, rstartcell.End(xlDown))

has no relevance to your sample of code as posted, rnum will always be the
value in A2

also, unless you are sure the variant rnum will never be string that

cannot
be coerced to a number -
Case 11 will error

also, suggest don't use the keyword 'Row' as an undeclared variable

Regards,
Peter T


"davegb" wrote in message
ps.com...
Wrote some test code to try to solve a problem in another post.

Sub RangeNumber()
Set ws = ActiveSheet

Set rstartcell = ws.Range("A2")
Set rNumber = ws.Range(rstartcell, rstartcell.End(xlDown))

Row = rstartcell.Row
rnum = Left(Cells(Row, 1), 2)
Select Case rnum

Case rnum = 11

But the code skips over Case rnum=11 and goes on to the next case, even
though rnum is 11. I also tried putting the 11 in quotes to tell XL
that it's text, but it didn't help. Any ideas why?

Thanks as always.




Thanks everybody for your replies! I'm still working on getting it all
straightened out, but I'm on track again.

 
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
Sumif number is greater than a number but less than another number lulu151 Excel Discussion (Misc queries) 2 May 7th 10 07:12 PM
How can I click on a telephone number in an Excel 2002 spreadsheet, and have the number dialed? jbclem Excel Discussion (Misc queries) 2 August 13th 09 01:57 AM
How to calculate number of occurencies of a specific number number Stefan Excel Discussion (Misc queries) 4 September 8th 08 08:33 AM
convert text-format number to number in excel 2000%3f Larry Excel Discussion (Misc queries) 1 July 29th 05 08:18 PM
Rounding a number to a multiple quantity that adds to a fixed total number wjlo Excel Worksheet Functions 1 November 9th 04 04:43 PM


All times are GMT +1. The time now is 02:26 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"