View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default If Activecell Question!!

You could use a case statement or If/Then/ElseIf. If you want the comparison
to be case sensitive, remove UCase.

Select Case UCase(ActiveCell.Value)
Case "TYP 450"
'Do Something
Case "TYP 490"
'Do something
Case "TYP 350"
'Do Something
Case Else '<<Optional
'Do Something
End Select


strTemp = UCase(ActiveCell.Value)
If strTemp = "TYP 450" Then
'Do Something
ElseIf strTemp = "TYP 490" Then
'Do Something
ElseIf strTemp = "TYP 350) Then
'Do Something
Else '<<Optional
'Do Something
End If




"Alastair79" wrote:

As part of my code I need to ask what the active cell contains, it will
always be text and one of three options (TYP 450, TYP 490, TYP 350)

IF Activecell = "TYP 450" then

Something along these lines. what would the actual code be.

Thanks...... Alastair.