If Activecell Question!!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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
 
IF Activecell.Value = "TYP 450" Or _
Activecell.Value = "TYP 490" Or _
Activecell.Value = "TYP 350" Then

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
ElseIf strTemp = "TYP 350) Then
s/b
ElseIf strTemp = "TYP 350" Then
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top