View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
joel[_956_] joel[_956_] is offline
external usenet poster
 
Posts: 1
Default Case Method & Range Object Problem


From look at your code your 8 posibilites are as follows


Row # Col A Col B Col C
iBB_DATA "#N/A" "#N/A" "#N/A"


When "#N/A" you get a 1
When not "#N/A" you get a zero

ResultA = 0
ResultB = 0
ResultC = 0

if Left(rTEST.Cells(iBB_DATA_Row, "A") = "#N/A" then
ResultA = 4
end if
if Left(rTEST.Cells(iBB_DATA_Row, "B") = "#N/A" then
ResultA = 2
end if
if Left(rTEST.Cells(iBB_DATA_Row, "B") = "#N/A" then
ResultA = 1
end if
Result = ResultA + ResultB + ResultC
Select Case ZEROorONE
Case 0
Case 1
Case 2
Case 3
Case 4
Case 5
Case 6
Case 7
end select



What you did is this

Case (Left(rTEST.Cells(iBB_DATA_Row, 1), 4) = "#N/A" And _
Left(rTEST.Cells(iBB_DATA_Row, 2), 4) = "#N/A" And _
Left(rTEST.Cells(iBB_DATA_Row, 3), 4) = "#N/A")

Your equation get the following type results

Left(rTEST.Cells(iBB_DATA_Row, 1), 4) = "#N/A" 'This equals TRUE or
False
Left(rTEST.Cells(iBB_DATA_Row, 2), 4) = "#N/A" 'This equals TRUE or
False
Left(rTEST.Cells(iBB_DATA_Row, 3), 4) = "#N/A" 'This equals TRUE or
False


So the resulting equation is something like this
Results = True and True and False

So your equation give TRUE when all three values are #N/A and FALSE
otherwise. This give only 2 cases.


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?u=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=199358

http://www.thecodecage.com/forumz