View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Can we use "*" to replace string in VBA excel macros ?

Sub proba2()
If InStr(1, Range("A1").Value, Range("B1").Value, vbTextCompare) 0 Then
ActiveCell.Offset(10, 0).Activate
End If
End Sub

You were testing the string literals/constants A1 and B1, not what was in
the Cells A1 and B1.

--
Regards,
Tom Ogilvy

"Tomek" wrote in message
...
Tom Ogilvy wrote:

The example I gave would produce where the string is found. As long as

it
isn't zero, you would copy. I am not sure why you can't make it. The
example needs no interpretation - When the condition is passed, you

copy.


I tried something like below but I do not know why it dosn't work

Sub proba2()
If InStr(1, "A1", "B1", vbTextCompare) 0 Then
ActiveCell.Offset(10, 0).Activate
End If
End Sub


in cell A1 I had string "very big car"
in cell B1 I had string "big"


--
Tomek