Link to home
Start Free TrialLog in
Avatar of Seamus2626
Seamus2626Flag for Ireland

asked on

VBA IF

Hi,

I need to wrap the below action in an IF

Basically IF Column B contains "Summary" then......

Else skip this part of code.....

Im getting a debug when summary doesnt exist

Thanks



    Columns("B:B").Select
    Selection.Find(What:="Summary", After:=ActiveCell, LookIn:=xlFormulas _
        , LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
        MatchCase:=False, SearchFormat:=False).Activate
        
    With ActiveCell
    
    .ClearContents
    .Offset(0, -1).ClearContents
    .Offset(1, -1).ClearContents
    
    End With

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of krishnakrkc
krishnakrkc
Flag of India 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 Seamus2626

ASKER

Thanks!