If y = x Like "x?" Then

  • Thread starter Thread starter TEAMRacing
  • Start date Start date
T

TEAMRacing

'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
 
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
 
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
 
Back
Top