Find value and remove/delete

Fwiz

Board Regular
Joined
May 15, 2007
Messages
241
I'm trying to figure out how to remove a value from a list using VBA, i have a name range for input, what ever is captured in that cell should automatically be deleted/cleared from worksheet 2 - column G

any ideas on how?
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
my first attempt was this:
Dim c As Range
For Each c In Range("g2:g200")
With c
If .Value = "i3" Then .ClearContents
End With
Next c
the code doesnt recognise the value in the cell reference I3 to remove the matching value from the list...
 
Upvote 0
Doh!! here is the correct version..

Dim c As Range
For Each c In Range("G2:G200")
With c
If .Value = Range("i3") Then .ClearContents
End With
Next c

Managed to figure out something soooo obvious!! anyway for those who may need something similar for the future!
 
Upvote 0

Forum statistics

Threads
1,215,842
Messages
6,127,227
Members
449,371
Latest member
strawberrish

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