Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

If Statement Excel VBA

Status
Not open for further replies.

JustATheory

IS-IT--Management
Feb 27, 2003
115
US
Greetings,

I'm working in Excel VBA and I'm writing an If statement,

If ActiveCell > 0 and < 4 Then

End If

It will error after the 0 and ask for goto or then. Is there a way to ask for a range in this statement?

Thanks,
Andy
 
If ActiveCell > 0 And ActiveCell < 4 Then

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Greetings,

Is there a way to use VLOOKUP with an operator such as "LIKE". I'm trying to determine if an entry in one list is in a cell with other entries. For instance:

Serial Number Serial Number
SN1234,SN5678,SN1357 SN1357
SN1357,SN8765,SN4321 SN1357

I'd like VLOOKUP to find the embeded Serial Number in the left column.

Any help would be appreciated.

Thanks,
Andy
 
Hi,

If all strings, you could make use of the InStr function ...

If InStr(1, Range("A2").Value, Range("B2").Value) <> 0 Then
'string was found in cell
Else
'string was NOT found in cell
End If

Adjust ranges to suit.

HTH

-----------
Regards,
Zack Barresse
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top