![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Apr 2002
Posts: 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? |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Mar 2002
Posts: 363
|
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
__________________
It's never too late to learn something new. Ricky |
|
|
|
|
|
#3 |
|
New Member
Join Date: Apr 2002
Posts: 21
|
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 ] |
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Mar 2002
Location: London, UK
Posts: 167
|
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.
__________________
<table style="background-color:#0e54be" cellspacing="1" cellpadding="2"><td style="background-color:#ceffff;font-family:arial;color:#072c63;font-size:8pt;">***DALEY** :P**</td></table> |
|
|
|
|
|
#5 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
Quote:
of each search string. If you want to get rid of ALL occurances then repost... |
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|