Macro help

XLerator

New Member
Joined
Apr 10, 2002
Messages
21
I have various data in a column, and I want to include deleting them in a formula macro.

For example, I want the macro to run so that whenever it sees ANY ROW which contains the Text XX, YY, or ZZ etc it erases it.


So the macro would basically look for any of those three values and delete the entire row they are in. It seems tough--any suggestions?
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Try this:

Sub Delete_XX_YY_ZZ()
Cells.Find(What:="XX").EntireRow.Delete
Cells.Find(What:="YY").EntireRow.Delete
Cells.Find(What:="ZZ").EntireRow.Delete
End Sub
 
Upvote 0
Awesome!

But, where do I type that in? Is there a drop down menu command, do I highlight it? Ideas?

I'm a novice :(

Thanks.
This message was edited by XLerator on 2002-04-11 18:53
 
Upvote 0
1. go into TOOLS > MACRO > VISUAL BASIC EDITOR

2. right click on the workbook or any of its objects, and choose ADD > MODULE

3. in the new module, paste this code.

4. with the cursor in the block of code, press F5 to run it. Otherwise, close down the visual basic editor window, and you can activate the macro by going into TOOLS > MACRO > MACROS and running it from there.
 
Upvote 0
On 2002-04-11 18:39, XLerator wrote:
Awesome!

But, where do I type that in? Is there a drop down menu command, do I highlight it? Ideas?

I'm a novice :(

Thanks.
This message was edited by XLerator on 2002-04-11 18:53

The code will only delete the 1st occurance
of each search string.
If you want to get rid of ALL occurances then
repost...
 
Upvote 0

Forum statistics

Threads
1,213,543
Messages
6,114,245
Members
448,555
Latest member
RobertJones1986

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