A Macro To Delete A Row That Does Not Contain A Given Word

Jun 9, 2009

I am trying to find a macro that deletes a row that does not contain a given word or string.

For example, if a row does not contain the string -> then delete it or even better select and move all such rows to another worksheet so that the main worksheet is left only with rows containing the string.

View 7 Replies


Macro To Look For A Specific Word And Delete Rows

Jan 27, 2009

I need to build a macro which will look for a specific word say :"ABC" in a particular column say "B" and delete 5 rows including the row containing the word "ABC"

View 6 Replies View Related

Find Particular Word And Delete Rows Macro

Aug 31, 2012

I am trying to get macro which will find word "Service" in sheet 1 and after that delete that row and below row.

View 1 Replies View Related

Macro To Delete Merged Rows According To Key Word

Oct 5, 2009

I have got an excel sheet with 2 columns A and B.

Column A's rows are merged according to column B. E.g.

Column A:

Row 1-7 (merged) Ron

Column B:

Row 1: New Jersey
Row 2: New Delhi
Row 3: New Jersey
Row 4: New York
Row 5: New York
Row 6: New Jersey
Row 7: New York

My result should be like:

Column A:

Row 1: Ron

Column B:

Row 1: New York

and similarly for other rows also.

PS: The no. of rows merged for column A can be different.

Also the keyword that should be present in Column B should be according to hierarchy, New York, New Delhi and then New Jersey i.e. first the macro should check for New York, if its present (in 1st 7 rows according to example given) then New York should be written in Coulmn B, if New York is not present then it should check for New Delhi and New Delhi should be written in Column B and if New York and New Delhi both are not present then it should check for New Jersey.

There are only 3 keywords which need to be checked i.e. New York, New Delhi and New Jersey.

If these 3 keywords are not present then the macro should not do anything.

View 9 Replies View Related

Macro To Find Word And Delete Group Of Cells?

Aug 1, 2014

I have an excel file, where there is a section "Additional Requirements". This section is repeated like 20-25 times in the sheet and has a group of merged cells below it to enter data as shown in the picture. Issue is that majority of these "Additional Requirements" are not filled by the user. Hence maybe only 3 or 4 are filled and I have to manually delete the rest. I tried the code below, but it doesn't do anything.Running the macro just jumps the cells slowly downwards the sheet. Maybe if the macro runs 10-15 times it reads the whole code and then moves on to the next row.8-1-2014 12-43-27 PM.png What I'm trying to achieve is:

1. for the macro to find "Additional Requirements"

2. Then check the Merged cell below it (thus the offset)

3. If this cell is blank, select this cell and the cell containing "Additional Requirements"

4. Delete entire rows of these cells/delete the selection (entirerow.delete). (I read somewhere to set a variable as selection and clear it, hence ive included in the unreadable code. This wasn't working either)

View 4 Replies View Related

Delete Row Containing A Word

Sep 24, 2013

I have a Sheet1 and I need to delete the entire row(s) that contain the word "BUYER" located in column A using VBA.

View 5 Replies View Related

Word Art Will Not Delete

Jan 4, 2008

There is a word art pic in my excel file and i tried all options to get rid but could not do it.

View 9 Replies View Related

Find Word And Delete Row?

May 8, 2014

I am trying to find the word ''New'' and then delete row.Here is my current code below...


My code works fine upuntil Loopwhile.

The reason for this, on this particular occasion there is only one line containing 'new' so the code has nothing to loop....

So I need to re write

[Code] ....

In order to account for the possibility only one row ft's the word 'New'

Also might be worth mentioning the word New could ft in amongst other data in the particular cell.

View 3 Replies View Related

How To Delete A Word In Date

Jan 24, 2013

I have a file in which the data is written in cell.

1g Injection Total
10mg Tablets Total
1.5% w/w Gel Total

i want the to delete the word "Total" from each cell so that i can use the vlookup formula to get the desired result from another file.if there is any solution.looking forward for the an easy and understandable reply.

View 4 Replies View Related

Delete Everything In Cell Beyond First Word

May 5, 2009

I'm trying to figure out the best way to pull information from different worksheets. One field which I require has slight alterations between the sheets. I'd like to delete everything in the cell except for the very first word.

Here is a simple example (and I'd have this all through column A for instance)

Cell A1 = Multiple words here

Lets say I want to delete everything in the cell except the word "multiple"

View 6 Replies View Related

Delete Row Based On Word Yes

Apr 24, 2012

Looking for a VBA code that deletes rows based on the word Yes. Column P to be precise

I have a Validation List in Column P and when the user will select "Yes" I need to have it delete the row that row. Any quick code?

View 2 Replies View Related

How To Delete Specific Word From Every Line?

Sep 9, 2013

For example, on cell A1 I have 123456 Total, how do I delete the word "Total"? I have abut 2000 lines. What formula do I use?

View 5 Replies View Related

Delete Rows With Cells That Contain Some Word?

Mar 4, 2014

How can I delete all rows that have a cell that starts with the letters APP

View 3 Replies View Related

Delete Specific Word From String

Feb 12, 2009

I want to delete a specific words from string but i have a problem with the code below. For example, i wan to delete the word "Inc" only but the problem with my code is that it is deleting from "Incorporated" too and i want only the code to delete only if it finds the word "Inc" only.

View 11 Replies View Related

Delete Entire Row If Specified Word Exist

Dec 12, 2009

In range A1:A300 I have a lotof words. What I want is to delete entire row if the cell value is Open date

View 3 Replies View Related

Delete Cell If Particular Word Found

Feb 14, 2012

I want to delete if my sheet have a value miles away

A1=0 miles away
a5=25 miles away
a30=50 miles away
how i delete these
"' means null

View 2 Replies View Related

Excel To Delete First Word In A Cell?

Sep 12, 2013

My text currently looks like:

"PEN228 PENICILLIN VK 250mg 28"

I need it to look like:

"PENICILLIN VK 250mg 28"

I searched the forum the last couple of days and got the following formula: =RIGHT(TRIM(E3),FIND("~",SUBSTITUTE(E3," ","~",LEN(TRIM(E3))-LEN(SUBSTITUTE(TRIM(E3)," ",""))))-1)

However that is leaving: "228 PENICILLIN VK 250mg 28". Unfortunately I need to get rid of all of the first word.

View 5 Replies View Related

Find A Word And Delete All Rows Above It

Dec 18, 2013

I get a report each week that has a bunch of unwanted header info. It used to be static and the macro just deleted the first 49 rows. I recently found out that the header format changed and it's been deleting crucial data.

I need something that will find the words "Medical Center" and delete all the rows above it, however many that may be...

View 4 Replies View Related

Automatically Delete Rows That Contain A Certain Word

May 15, 2007

I can trying to let the user type a word in to cell A1 and then have Excel remove the rows that contain the word. But VBA below just seem to delete all nonblank rows?

sub delete2()
For Each cell In Selection
If cell.Value = A1 Then
End If
Next cell
end sub

how I can update this code?

View 9 Replies View Related

If Cell Contains The Word Delete Entire Row

Dec 10, 2008

Looking to write a macro to delete an entire row if the word GROWTH is found in any cell under Column C.

View 9 Replies View Related

Delete Row When A Selected Word Is In A Sentence

Oct 23, 2009

i have this macro that currently looks in column J and if a cell contains "Total" it deletes the entire row.

Now what i need is to check in same column but i need it to delete the entire row if any part of the sentence in a cell within column J contains "Main Total"

Sub Macro1()

'this deletes all rows if cell in column J says "total"

Dim DeleteValue2 As String
Dim rng2 As Range
Dim calcmode2 As Long

With Application
calcmode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

View 9 Replies View Related

Delete Rows :: Where Specific Word Appears

Jul 22, 2008

I have a spreadsheet that I need VBA Code to do the following

1) Delete all rows where the word totals appears in Column B for eg "Totals for Vehicles Stocked in 0706" "Totals for Vehicles Stocked in 0707" etc

2) Delete all rows where the value in col m is less than 45

I have written the code, but cannot get it to work-see my code below

Sub Del_TOTALS_Underaged()
FinalRow = Cells(65536, 2).End(xlUp).Row
For i = FinalRow To 1 Step -1
If Cells(i, 2).Value >= "Totals" Then
Cells(i, 1).EntireRow.Delete
If Cells(i, 13).Value < "45" Then
Cells(i, 1).EntireRow.Delete
End If
End If
Next i

End Sub

View 9 Replies View Related

Delete Range Names Containing Specific Word

Jun 6, 2008

the active sheet contains a number of defined named ranges. i would like to delete range names beginning with "Sales", yet the number of defined ranges changed from sheet to sheet = for example, Sheet1 may have 3 defined ranges (Sales1, Sales2, Sales 3), Sheet 2 may have 1 (Sales 1). Is it possible to included a wildcard search in the following code?

Sub DeleteRangeNames()
Dim RangeName As Name
For Each RangeName In Names
Next RangeName
End Sub

View 3 Replies View Related

Excel 2003 :: Use Find And Replace To Delete Word?

Dec 1, 2005

I'm looking to simply delete certain words that are in cells, without having to delete rows, columns or the entire cell. I can use 'find and replace' and replace the particular word with a space, but I really want to delete the word. I'm using both Excel 2003 and 2000.

View 4 Replies View Related

Delete Entire Column If Word False Exists?

Apr 9, 2014

I have the following code, but it takes longer than expected to run. Is there anyway to speed this up? I am not sure if autofilter is a option. I just want to search through range A16:Z16 and if the word "FALSE" exists delete the entire column. The word "TRUE" is the only other word that would exist in range A16:Z16


View 6 Replies View Related

Vba Code To Delete The Empty Bookmarks In Word Document?

Mar 17, 2014

I have been automating reports that will be generated in word documents for every company. The baseline is that I have a excel sheet which contain the data inputs and a word template document (template with bookmarks). I have written a macro that generate the reports when the user clicks the button but found that there some reports that generates empty bookmarks since there is no data for the corresponding bookmark. I have uploaded the excel sheets that has the full data and the setup sheets. The setup sheet has the Column Number, Bookmark Name, Description. The data sheet has the data values and the code info sheet has the name of the template doc and the name of the destination folder where the reports will be generated and stored. My requirement is to delete the empty bookmark from the report named "Blackberry". where to write the macro for deleting the empty bookmarks and its sentences (whether its in excel book or word template doc)?

View 3 Replies View Related

Opening Word & Count Word Instances In A Word Document

May 26, 2006

I have an excel program that is supposed to count word instances in a word document. I can't seem to find the right declaration for a word document.
For example to declare a workbook in excel its

Dim wb As Work Book

I've tried

Dim doc As Word.Document
Dim doc As Word.Application

as shown in some of the forum posts, but an error user-type not defined keeps displaying.

View 2 Replies View Related

Macro Delete Page (delete A Sheet In A Macro But When I Run The Macro)

Jun 19, 2009

I want to delete a sheet in a macro but when I run the macro, I always get a message warning and I have to answer the msg box to delete the page. Below is the macro command I am using.


View 4 Replies View Related

Delete The Rows Until It Meets A Cell With The Word "Date"

Mar 9, 2007

I am trying to make a simple program that will go down column A deleting the rows until it meets a cell with the word "Date" in the A column. When it has found that row I want it to delete that row also and then stop.

This is what I have so far

Sub FindAndDelete()

Dim row As Integer
Dim col As Integer


If Range("a1") "date" Then Rows("1:1").Select
End Sub

I tried defining row =1
col = 1

and then going if range ("rowcol") but no joy.

View 9 Replies View Related

Delete Empty Rows And Empty Columns From Word Table

Mar 25, 2014

I am trying to populate the 2 tables from excel to word. I will be getting the excel file with tables in various sheets. One sheet consist of 2 tables that will be inserted to one word document. So if there are 2 sheets then I will have the tables inserted in the 2 word document. In the excel sheet I have attached, there are 2 sheets with tables in each of them. I have written the code to copy and paste the table to word doc from (general) range A1:G4 (Table 1) and A9:H18 (Table 2) that has empty rows and columns selected. But there are empty rows and columns inserted since the table range is not same sheetwise. I would like get the empty rows and columns deleted in the word table.

Find the attached sample excel sheet and the word documents.


View 2 Replies View Related

Copyrights 2005-15 www.BigResource.com, All rights reserved