![]() |
If Activecell Question!!
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. |
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. |
If Activecell Question!!
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) "Alastair79" wrote in message ... 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. |
If Activecell Question!!
ElseIf strTemp = "TYP 350) Then s/b ElseIf strTemp = "TYP 350" Then "JMB" wrote: 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. |
All times are GMT +1. The time now is 02:54 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com