ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Compare cell value with string (https://www.excelbanter.com/excel-programming/429175-re-compare-cell-value-string.html)

Jacob Skaria

Compare cell value with string
 
You are looking of both the below conditions to be true. So use AND

If (Cells(loop_counter, "B").Value < "SoftwaInternal" And
Cells(loop_counter, "B").Value < "SoftwaTest Fixed Fee") Then

If this post helps click Yes
---------------
Jacob Skaria


"Shahriar Nour Khondokar" wrote:

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.



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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com