Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default 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   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.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default 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   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ActiveCell.Offset Question ash3154 New Users to Excel 5 September 12th 09 01:46 PM
If activecell.column = variable then activecell,offset (0,1) Battykoda via OfficeKB.com Excel Discussion (Misc queries) 1 October 2nd 07 08:05 PM
ActiveCell.Address question RAP Excel Programming 4 August 14th 05 03:57 PM
Activecell - Probably very easy question MattShoreson[_19_] Excel Programming 1 June 7th 05 03:27 PM
ActiveCell.Top question Brad K. Excel Programming 1 March 14th 05 03:29 AM


All times are GMT +1. The time now is 12:13 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"