Link to home
Start Free TrialLog in
Avatar of camper12
camper12

asked on

vba code

Hi,

what would be the vba code to search for a string in a particular column and return true if a match is present?

Thanks
Avatar of camper12
camper12

ASKER

This is what I have

ElseIf (((Range("A17").Value = "A") Or Range("B17").Value = "C") And (Range("C17").Value = Columns("C1:C16").Select
    Set cell = Selection.Find(What:=Range("C17").Value, After:=ActiveCell, LookIn:=xlFormulas, _
        LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
        MatchCase:=False, SearchFormat:=False)))
SOLUTION
Avatar of Anthony Berenguel
Anthony Berenguel
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Roy Cox
It's not clear what ranges you are using. If you want to check if the value of C17 appears more than once in Range("C1:C17") then this should work


If Application.WorksheetFunction.CountIf(Range("C1:C17"), Range("C17")) > 0 Then MsgBox "True" 

Open in new window

ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial