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
 

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

Similar Threads

Run Time Error "13": Type mismatch 6
Excel hangs 1
Efficient looping 6
Loop Repeats - PLS HELP 2
If/Then 3
code wont compare negative numbers correctly 3
If statement(rookies) 3
Need help-For loop 3

Back
Top