VBA Variable
Hi,
Try this
Sub Sonic()
Select Case UCase(Sheets("Sheet1").Range("A1").Value)
Case "RED"
GoTo RED
Case "BLUE"
GoTo BLUE
Case "GREEN"
GoTo GREEN
Case Else
MsgBox "No Match"
Exit Sub
End Select
RED:
'Do RED things
Exit Sub
BLUE:
'Do BLUE Things
Exit Sub
GREEN:
'Do GREEN Things
End Sub
Mike
"Newbie" wrote:
Hi,
I am trying to run a routine based on the value in a cell, for example A1
might contain RED, BLUE or GREEN.
In the VBA I would have
x = Range("A1") .value
goto x
end
RED:
'red routine here
end
BLUE:
'blue routine here
end
GREEN
'green routine here
end
...but it doesn't work, any help much appreciated.
|