VBA. Delete row in a range if Values in Column A do not equal Cell B2

MsPretzel

New Member
Joined
Jun 14, 2018
Messages
5
I am very rusty on VBA and need some help!
I need to delete rows within a range (rows 6 to 85) if the value in Column A does not equal B2.
I have pasted some example data below

ABC
1CurrencyGBP
2EmployeeCharlie
3
4EmployeeEvent nameValue
5AbiLondon2
6BeckySingapore4
7CharlieParis3
8DaveLondon4
9
EdSingapore3
10CharlieParis6
11DaveLondon3
12EdSingapore6
13CharlieParis4
14AbiLondon3

<colgroup><col><col><col><col></colgroup><tbody>
</tbody>
 
Can you please post what worked so that anyone in future can see what the solution was? Thanks mate, glad its working for you!
 
Upvote 0

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Both codes should work.
I'm thinking along on the same lines as James.
In a blank cell enter =LEN(B2)
& in another blank cell enter =LEN(A7) Pointing to a cell that = B2
Do both formulae give the same results?
 
Upvote 0
They both worked, I went back and did a thorough check, I'd added an extra space in between a first and last name!
It is really appreciated, saved me from going completely crazy!
 
Upvote 0
Glad you got it sorted & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,214,516
Messages
6,119,976
Members
448,934
Latest member
audette89

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top