Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi...
My code is: If Cells(rw, colno).Value = "US" Or _ Cells(rw, colno).Value = "AI" Then With Cells(rw, colno) If UserForm1.ch_sensrtype_d.Value = False Then .Value = UserForm1.sensrtype.Value Else .Value = sensrtype_d End If ENd IF In the line Cells(rw, colno).Value = "AI", I am comapring cell value with "AI". However, here I want to search if any part of the cell contains "AI". Measn, if my cell has value "AIT", then also this statement should become true. I tried writing "*" & "AI" & "*" but it doesnt work. How can I do this? Regards, Pawan |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() If Cells(rw, colno).Value = "US" Or _ Cells(rw, colno).Value Like "*AI*" Then -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Pawan" wrote in message ... Hi... My code is: If Cells(rw, colno).Value = "US" Or _ Cells(rw, colno).Value = "AI" Then With Cells(rw, colno) If UserForm1.ch_sensrtype_d.Value = False Then .Value = UserForm1.sensrtype.Value Else .Value = sensrtype_d End If ENd IF In the line Cells(rw, colno).Value = "AI", I am comapring cell value with "AI". However, here I want to search if any part of the cell contains "AI". Measn, if my cell has value "AIT", then also this statement should become true. I tried writing "*" & "AI" & "*" but it doesnt work. How can I do this? Regards, Pawan |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Bob...
I have onem ore doubt in this. My macro is searching for "US" (i.e. Uppercase). If there is "us" in some cells, its not working. Can we make it work? Regards, Pawan "Bob Phillips" wrote: If Cells(rw, colno).Value = "US" Or _ Cells(rw, colno).Value Like "*AI*" Then -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Pawan" wrote in message ... Hi... My code is: If Cells(rw, colno).Value = "US" Or _ Cells(rw, colno).Value = "AI" Then With Cells(rw, colno) If UserForm1.ch_sensrtype_d.Value = False Then .Value = UserForm1.sensrtype.Value Else .Value = sensrtype_d End If ENd IF In the line Cells(rw, colno).Value = "AI", I am comapring cell value with "AI". However, here I want to search if any part of the cell contains "AI". Measn, if my cell has value "AIT", then also this statement should become true. I tried writing "*" & "AI" & "*" but it doesnt work. How can I do this? Regards, Pawan |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If LCase(Cells(rw, colno).Value) = "us" Or _
Cells(rw, colno).Value Like "*AI*" Then this will work for us, US, Us, or uS, that is it is non case-sensitive. -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Pawan" wrote in message ... Thanks Bob... I have onem ore doubt in this. My macro is searching for "US" (i.e. Uppercase). If there is "us" in some cells, its not working. Can we make it work? Regards, Pawan "Bob Phillips" wrote: If Cells(rw, colno).Value = "US" Or _ Cells(rw, colno).Value Like "*AI*" Then -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Pawan" wrote in message ... Hi... My code is: If Cells(rw, colno).Value = "US" Or _ Cells(rw, colno).Value = "AI" Then With Cells(rw, colno) If UserForm1.ch_sensrtype_d.Value = False Then .Value = UserForm1.sensrtype.Value Else .Value = sensrtype_d End If ENd IF In the line Cells(rw, colno).Value = "AI", I am comapring cell value with "AI". However, here I want to search if any part of the cell contains "AI". Measn, if my cell has value "AIT", then also this statement should become true. I tried writing "*" & "AI" & "*" but it doesnt work. How can I do this? Regards, Pawan |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Great.. Thanks Bob..! :-)
"Bob Phillips" wrote: If LCase(Cells(rw, colno).Value) = "us" Or _ Cells(rw, colno).Value Like "*AI*" Then this will work for us, US, Us, or uS, that is it is non case-sensitive. -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Pawan" wrote in message ... Thanks Bob... I have onem ore doubt in this. My macro is searching for "US" (i.e. Uppercase). If there is "us" in some cells, its not working. Can we make it work? Regards, Pawan "Bob Phillips" wrote: If Cells(rw, colno).Value = "US" Or _ Cells(rw, colno).Value Like "*AI*" Then -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Pawan" wrote in message ... Hi... My code is: If Cells(rw, colno).Value = "US" Or _ Cells(rw, colno).Value = "AI" Then With Cells(rw, colno) If UserForm1.ch_sensrtype_d.Value = False Then .Value = UserForm1.sensrtype.Value Else .Value = sensrtype_d End If ENd IF In the line Cells(rw, colno).Value = "AI", I am comapring cell value with "AI". However, here I want to search if any part of the cell contains "AI". Measn, if my cell has value "AIT", then also this statement should become true. I tried writing "*" & "AI" & "*" but it doesnt work. How can I do this? Regards, Pawan |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Text "comparison" operator for "contains" used in an "IF" Function | Excel Worksheet Functions | |||
Comparison Operator "" NOT "=" | Excel Discussion (Misc queries) | |||
Complex comparison of Columns of Data: Extracting unique records after comparison on 4 levels | Excel Programming | |||
Adding a comparison Operator button on a toolbar | Excel Discussion (Misc queries) | |||
"IN" comparison operator | Excel Programming |