Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default using AND and OR as an if then condition

Hi,
I am trying to create an if then statment that uses as its condition.

IF active.cell.value = (A or B) and Activecell(offset(0,3).value = C
then execute.

I am having problems with (A or B).

I could use some help with the context of the statement. A,B, and C
are all different ComboBox values. This is part of a look up routine
that sets down through one sheet and then copies values to another
sheet.

Thanks in advance,
Frank
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default using AND and OR as an if then condition

Frank,

Try this

With ActiveCell
If (.Value = A OR .Value = B) AND .Offset(0,3).Value = C Then
'...
End If
End With

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Frank Brown" wrote in message
om...
Hi,
I am trying to create an if then statment that uses as its condition.

IF active.cell.value = (A or B) and Activecell(offset(0,3).value = C
then execute.

I am having problems with (A or B).

I could use some help with the context of the statement. A,B, and C
are all different ComboBox values. This is part of a look up routine
that sets down through one sheet and then copies values to another
sheet.

Thanks in advance,
Frank



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default using AND and OR as an if then condition

Frank Brown wrote:

Hi,
I am trying to create an if then statment that uses as its condition.

IF active.cell.value = (A or B) and Activecell(offset(0,3).value = C
then execute.


Correct syntax would be:

If (ActiveCell.Value = A Or Activecell.Value = B) And _
ActiveCell.Offset(0,3).Value = C Then
' Code if condition is true
End If

Regards,
--
Beto
Reply: Erase between the dot (inclusive) and the @.
Responder: Borra la frase obvia y el punto previo.

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
If Condition Kumar Excel Discussion (Misc queries) 0 December 5th 08 03:05 PM
lookup with multiple condition, but one condition to satisfy is en Eddy Stan Excel Worksheet Functions 2 October 27th 07 02:06 PM
Combine an OR condition with an AND condition Will Excel Discussion (Misc queries) 1 April 6th 07 03:52 PM
Max or Min with condition Marc Excel Worksheet Functions 2 May 24th 06 10:08 PM
Condition 1 overules condition 2? Bultgren Excel Worksheet Functions 2 January 20th 06 12:29 PM


All times are GMT +1. The time now is 04:04 PM.

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

About Us

"It's about Microsoft Excel"