Select Case testexpression

  • Thread starter Thread starter rob nobel
  • Start date Start date
R

rob nobel

I would like to understand the Select Case method to use instead of if -
then.
As I understand this structure, the Select Case line should have a
testexpression where I have put ???.
I don't understand what that means and I can't get the following to work
without that. Can someone please explain how to get the following code to
work.

Rob

Select Case ???
Case ActiveCell = Range("R25").Value
ActiveCell.Offset(0, 6).Activate
ufTaxWithheld.Show
Exit Sub

Case ActiveCell = Range("S25").Value
ActiveCell.Offset(0, 7).Activate
ufTaxWithheld.Show
Exit Sub
End Select
 
One way:

Select Case ActiveCell.Value
Case Range("R25").Value
Activecell.Offset(0, 6).Activate
ufTaxWithheld.Show
Exit Sub
Case Range("S25").Value
ActiveCell.Offset(0, 7).Activate
ufTaxWithheld.Show
Exit Sub
End Select

The test expression is the variable or expression to be compared with
the Case values.

If the test expression is equal to a Case value, that Case is executed,
then control reverts to the End Select statement.
 
That's so simple now that you explain it JE.
I was trying to put the active cell RANGE in that spot.
Thank you so much!
Rob
 
Back
Top