G
Guest
The trouble with having programmed for a long time in one language is that
your thought system for design constantly works along the same routes. Here
is a simple Case statement...
If dblSubTotal > 0 Then
Select Case strSalaryOrHour
Case "S" And lngPenRow > 0
Set rngWorkCell = Cells(lngPenRow, 20)
Case "S" And lngPenRow = 0
lngPenRow = 1
Set rngWorkCell = Cells(lngPenRow, 20)
Case "H" And lngPn2Row > 0
Set rngWorkCell = Cells(lngPn2Row, 21)
Case "H" And lngPn2Row = 0
lngPn2Row = 1
Set rngWorkCell = Cells(lngPn2Row, 21)
End Select
rngWorkCell.Select
rngWorkCell.Value = dblSubTotal
End If
Where everything is Dimmed, and lngPenRow (or lngPn2Row) will have received
a value in the If construct immediately preceding this. Unfortunately each
Case is based on a compound test, where one part is Character and one part is
Numeric, and (I hate to confess this in public) I did read the Help file on
Case, so I know why that dog don't hunt.
So how must I re-structure this to get to where I'm trying to go
(rngWorkCell.Value = dblSubTotal)?
your thought system for design constantly works along the same routes. Here
is a simple Case statement...
If dblSubTotal > 0 Then
Select Case strSalaryOrHour
Case "S" And lngPenRow > 0
Set rngWorkCell = Cells(lngPenRow, 20)
Case "S" And lngPenRow = 0
lngPenRow = 1
Set rngWorkCell = Cells(lngPenRow, 20)
Case "H" And lngPn2Row > 0
Set rngWorkCell = Cells(lngPn2Row, 21)
Case "H" And lngPn2Row = 0
lngPn2Row = 1
Set rngWorkCell = Cells(lngPn2Row, 21)
End Select
rngWorkCell.Select
rngWorkCell.Value = dblSubTotal
End If
Where everything is Dimmed, and lngPenRow (or lngPn2Row) will have received
a value in the If construct immediately preceding this. Unfortunately each
Case is based on a compound test, where one part is Character and one part is
Numeric, and (I hate to confess this in public) I did read the Help file on
Case, so I know why that dog don't hunt.
So how must I re-structure this to get to where I'm trying to go
(rngWorkCell.Value = dblSubTotal)?