简体   繁体   中英

Clear Cell if Cell Contains Text VBA Excel

Need help with clearing contents of a cell if a cell contains 2 specific texts:

This is my formula:

For p = lrow To 2 Step -1
    
    If ws3.Cells(p, 10).Value = "Carrier is disabled" Or ws3.Cells(p, 10).Value = "No Error Message" Then
        ws.Cells(p, 10).ClearContents
    End If

Next p

Not working at the moment :D

Any help will be greatly appreciated.

Thank you!

The learcontents has a incorrect worksheet name. Assuming everything else not shown here is correct, change...

ws.Cells(p, 10).ClearContents

to

ws3.Cells(p, 10).ClearContents

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM