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

I am working with 2 Sheets and 3 Range Objects:

Set wsDATA = Worksheets(SHEET_SOURCE)
Set wsWORKPLACE = Worksheets(SHEET_WORKPLACE)

Set rSID = wsDATA.Range("A5:A563")
Set rTEST = wsDATA.Range("M5:O563")
Set rDEST = wsWORKPLACE.Range("AC5:AI563")

I am using the Case Method with 8 Case possibilities plus a 'Case
Else'. My Code's first Case possibility is:

Select Case ZEROorONE

'POSSIBILITY #1 - 3 CELLS = 0 ("BAD" DATA)
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")

iTST_1_POSS = iTST_1_POSS + 1

'NO "GOOD" DATA TO COPY
rDEST.Cells(iWP_Row, 1) = "13" '<< DEF CELL REF TO wsDATA
'NAMED RANGE'
rDEST.Cells(iWP_Row, 2) = rSID.Cells(iBB_DATA_Row, 1)
rDEST.Cells(iWP_Row, 6) = "ZERO RTGS"

iWP_Row = iWP_Row + 1
ActiveCell.Offset(1, 0).Select
iBB_DATA_Row = iBB_DATA_Row + 1

Before invoking the Case Method, my Code has several MsgBox's; in each
of these Box's the correct value is returned for each of the variables
requested. Also, the correct values are "written" to the specified
locations in the rDEST Range. However, the Case Method does not
always select the appropriate Case possibility (I can see this when I
step thru my Code), using the same variables as specified in the
MsgBox's.

I find this VBA behavior very strange. Help.