If y = x Like "x?" Then

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
 
S

steve

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
 
T

TEAMRacing

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top