Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
Try replacing your 'Or' with 'And': If (Cells(loop_counter, "B").Value < "SoftwaInternal" And _ Cells(loop_counter, "B").Value < "SoftwaTest Fixed Fee") Then .... End If Alternatively, since you're already testing with you might as well use: If (Cells(loop_counter, "B").Value = "SoftwaInternal" Or _ Cells(loop_counter, "B").Value = "SoftwaTest Fixed Fee") Then .... Else ....' insert your negative response here End If -- Cheers macropod [Microsoft MVP - Word] "Shahriar Nour Khondokar" wrote in message ... Hi all I am trying to compare (and identify) the values in a column with 2 strings. i am using the following code: If (Cells(loop_counter, "B").Value = "SoftwaInternal" Or Cells(loop_counter, "B").Value = "SoftwaTest Fixed Fee") Then ... End If 'loop_counter' is a variable that has been declared. This piece of code does its job and identifies cell in column-B that have "SoftwaInternal" and "SoftwaTest Fixed Fee" as value. But when i try to use the code below to identify the cells that do NOT have "SoftwaInternal" and "SoftwaTest Fixed Fee" as Value, it is not working: If (Cells(loop_counter, "B").Value < "SoftwaInternal" Or Cells(loop_counter, "B").Value < "SoftwaTest Fixed Fee") Then ... End If Can someone please help me understand why is this not working and what can i use to get the desired result? Thanks for you help. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Compare cell value with string | Excel Programming | |||
Compare cell value to items in string | Excel Programming | |||
Compare text string of a cell in Column A VS another cell in Colum | New Users to Excel | |||
Compare text string of a cell in Column A VS another cell in Colum | Excel Worksheet Functions | |||
Compare String in Cell to an Array | Excel Programming |