View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default number not a number?

Because rnum is a variant type string because you performed a string
function on it.

Try

Case rnum "11"

or

rnum= INT(Cells(Row, 1)

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"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.