eyoung4909
New Member
- Joined
- Jul 17, 2018
- Messages
- 3
I have been working on a vba macro for a spreadsheet that i am setting up for accounting. What I need to do is to have the vba check the data in column F and if the criteria matches then I need it to clear the contents in column E of the same row as column F. I have it working to get an exact match for the cell but what I need is a way to do a wild card search with a few key words. The code that works for the exact match is:
putting in "IL 9.0% (IL 9% SALES TAX)" works every time but we have quite a few different ways that Quick Books lists out the sales tax for each state and each percentage of sales tax in the exported spreadsheet that I am working from. I was hoping that there was a way to "wild card" the word "Sales Tax" (since the words sales tax is constant in every variation) into the code to replace having to have each and every available type "Sales tax" entry in the code.
Code:
Sub test1()
For Each Cell In Range("F3:F9999")
If UCase(Cell) = "IL 9.0% (IL 9% SALES TAX)" Then Cell.Offset(0, -1).ClearContents
Next
End Sub
putting in "IL 9.0% (IL 9% SALES TAX)" works every time but we have quite a few different ways that Quick Books lists out the sales tax for each state and each percentage of sales tax in the exported spreadsheet that I am working from. I was hoping that there was a way to "wild card" the word "Sales Tax" (since the words sales tax is constant in every variation) into the code to replace having to have each and every available type "Sales tax" entry in the code.