Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
ActiveCell.Offset Question | New Users to Excel | |||
If activecell.column = variable then activecell,offset (0,1) | Excel Discussion (Misc queries) | |||
ActiveCell.Address question | Excel Programming | |||
Activecell - Probably very easy question | Excel Programming | |||
ActiveCell.Top question | Excel Programming |