ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   If y = x Like "x?" Then (https://www.excelbanter.com/excel-programming/276855-if-y-%3D-x-like-x-then.html)

TEAMRACING

If y = x Like "x?" Then
 
'I am trying to compare two numbers. I want excel to
recognize "255135" to "255135k" I can't seem to get this
to work. Any help would be appreciated. Thanks

x = UCase(ActiveCell.Value)
ActiveCell.Offset(1, 0).Select
y = UCase(ActiveCell.Value)
If y = x Like "x?" Then
ActiveCell.Offset(0, 1).Select

steve

If y = x Like "x?" Then
 
You're close... try this

Dim x, y

x = UCase(ActiveCell.Value)
ActiveCell.Offset(1, 0).Select
y = UCase(ActiveCell.Value)
If y Like x Then
MsgBox "y like x"
ActiveCell.Offset(0, 1).Select
Else
MsgBox "y not like x"
End If

--
sb
"TEAMRacing" wrote in message
...
'I am trying to compare two numbers. I want excel to
recognize "255135" to "255135k" I can't seem to get this
to work. Any help would be appreciated. Thanks

x = UCase(ActiveCell.Value)
ActiveCell.Offset(1, 0).Select
y = UCase(ActiveCell.Value)
If y = x Like "x?" Then
ActiveCell.Offset(0, 1).Select




TEAMRACING

If y = x Like "x?" Then
 
Got it! This is what I used.

x = UCase(ActiveCell.Value)
ActiveCell.Offset(1, 0).Select
y = UCase(ActiveCell.Value)
Dim SearchString, SearchChar, MyPos
SearchString = "y"
SearchChar = "x"
MyPos = InStr(1, y, x, 1)
If MyPos = 1 Then




-----Original Message-----
'I am trying to compare two numbers. I want excel to
recognize "255135" to "255135k" I can't seem to get this
to work. Any help would be appreciated. Thanks

x = UCase(ActiveCell.Value)
ActiveCell.Offset(1, 0).Select
y = UCase(ActiveCell.Value)
If y = x Like "x?" Then
ActiveCell.Offset(0, 1).Select
.


Tom Ogilvy

If y = x Like "x?" Then
 
if y like (x & "?") then

y = "255135k"
x = 255135

--
Regards
Tom Ogilvy



"TEAMRacing" wrote in message
...
'I am trying to compare two numbers. I want excel to
recognize "255135" to "255135k" I can't seem to get this
to work. Any help would be appreciated. Thanks

x = UCase(ActiveCell.Value)
ActiveCell.Offset(1, 0).Select
y = UCase(ActiveCell.Value)
If y = x Like "x?" Then
ActiveCell.Offset(0, 1).Select





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

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