Delete Rows Which Do Not Contain Certain Text

Feb 21, 2008

I have a spreadsheet which is created 2/3 times daily and I need a macro to do the following;

The columns are A To AJ, I need to delete all columns with the exception of columns M, N, R

Column M contains currency (GBP, Euro)
Column N contains dates
Column R contains various agent log ins, such as LI111222AB, LI222111JM, IFCTest & HOTAYLORL

The row number can vary (Average 1,000), I need to delete all rows that do not contain a log in which begins with LI in column R

Once this is done, subtotal by column R (agent log in), column N, & column M

View 9 Replies


ADVERTISEMENT

Delete Rows With No Text?

Oct 25, 2013

I'm trying to write a line of code in my VBA macro that goes through all of column B and if there is text in the column to go to the next cell down and if there is no text to delete the entire row. I have the bricks I just cant build the house. I need the macro to do this for rows 8 to 500.

View 5 Replies View Related

Delete Rows Without Specified Text

Jun 27, 2007

What i'd like is a macro that will delete all cells that don't contain the word pagelibrary somewhere in the cell. As these are weblogs, pagelibrary can be in many different places in the link due to redirects etc, so the macro would have to be flexible with that word. All cells are only one column, in column A. Also if it is possible to delete everything before the word pagelibrary that would be helpful as well as some of these links are very long (and possibly duplicates due to capitalization and redirects).

I've done some searching and this code is the code that closest matches what I want to do. I am by no means a VBA expert; I can decipher a little of what code does, I just can't write it .

Sub DeleteRowEqualTo()
‘Hold Shift Key To delete rows Not equal To

Application. ScreenUpdating = False
Dim currentRow As Long
Dim lastRow As Long
Dim activeColumn As Long

Dim activeValue As String
Dim currentValue As String

lastRow = ActiveSheet.Cells.SpecialCells(xlLastCell).Row
activeColumn = ActiveCell.Column

activeValue = ActiveCell.value ................................

View 9 Replies View Related

Delete Rows Containing Text

Aug 9, 2007

I am trying to write a code that would remove rows with any sort of letters in them. I have looked up other ways of deleting rows, but I cannot find the script that would encompass all (alphabetical) letters.

View 9 Replies View Related

To Delete All Rows Without Specific Text

May 7, 2013

I need a macro in excel which work like that "To delete all rows without specific text". and following macro for this;

What I need in this is that i have more than one values (highlighted with red in formula) so how i will do in this?

Sub DeleteRows()
Dim lRow As Long
Dim lLastRow As Long

'Change "A" to suit
lLastRow = Cells(Rows.Count, "A").End(xlUp).Row

[Code] .....

View 3 Replies View Related

Macro To Delete Rows Containing Certain Text

Jan 15, 2009

I have put together a macro that will delete rows (called DeleteUnwantedRows) in a spreadsheet that contain the phrases "no further action" and "not applicable" ... However the macro does not appear to be working.

View 2 Replies View Related

Delete Rows Containing Text With A Certain Suffix?

Aug 1, 2013

Each day I recieve a spreadsheet with thousands of row. In col A there is data that has "-NCA1" or "NCA2" as the suffix. I have to "delete" these rows before proceding.

I'd like to know if there is a way to do this with a macro and ideally delete a wildcard suffix with "NCA*" in case any 3...4..5 etc are added.

View 4 Replies View Related

Use A Macro To Delete Rows With Text

Jan 24, 2008

how to use a macro to delete rows that have text in them. I have an imported text file that has headings every 10 rows and I need to take out the heading rows

View 9 Replies View Related

Trying To Delete Rows That Have Text Only In Column

May 3, 2006

I have a spreedsheet that has both numerical data and text data in column "A". I need to delete all the rows that have text in Column A and keep the rows that have numerical data.

View 5 Replies View Related

Find Text & Delete All Rows Below

May 17, 2008

I have a report that comes in a txt file. After importing into excel i am left with a bunch of garbage that i dont need. This report is anywhere from 5-15 pages depending on how much product was made that shift. I only need the information off of the 1st page. My question is how can i Find the first occurance of specific text (Site) (will be in column A) and have it select that row and all rows below and delete them.
My biggest issue is the first page can be anywhere from 40-60 rows so I need to find the text (Site) and delete everything below it, which could be anywhere from 500-1500 rows.

View 2 Replies View Related

Delete Rows That Dont Have Certain Text

Jun 26, 2008

I have a sheet with data only in column A. I want to remove any rows that dont contain the word MAR. All the lines with MAR in start with: CN=GR GG COF MAR ****
macro which would do this as i have over a 100 sheets. and maybe an explanation as i am totally new to this?

View 2 Replies View Related

Search For Matching Text, Then Delete Rows Above It

Jul 8, 2009

Here is what Im trying to do: I have a VERY large excel file that has groups of 4 cells, a blank, then another 4, repeating. Kinda like the following:

ExampleCell1
ExampleCell2
ExampleCell3
UID = example

ExampleCell1
ExampleCell2
ExampleCell3

ExampleCell1
ExampleCell2
ExampleCell3
UID = example


That pattern continues for about 3000 lines. However, if you noticed, some of the "groups" dont have the 4th line "UID = example".

Here is what Im trying to do. I want excel to search for the cells with "UID" and DELETE it plus the 3 rows above. So that only the "groups" without the UID remain.

Now Im thinking this may be impossible, but I've seen some crazy things done with excel macros and was really hoping someone can help me out. Otherwise Im doing this manually for 3000+ lines of text.

View 7 Replies View Related

Delete Rows Based On A Text Criteria

Aug 24, 2009

I am trying to figure out how to have some VBA look down Column 1 and where the Cell's string value = "GRANDTOTAL", to DELETE that ROW and ALL ROWS below.

Can anyone help me out in writing the Visual Basic code?

View 8 Replies View Related

Import Text Files: Delete 1st & Last Rows

Oct 25, 2006

i am importing a large number of text files from a folder into an excel worksheet (into column A) and found the following code from searching the forum.

Sub Import_Text_Files()

Const PATH = "C:Documents and SettingsSilent BazMy DocumentsElectronic Gift Card WorkTestTextFolder"

Dim My_Filenumber As Integer
Dim My_File As String
Dim My_Data As String

My_File = Trim(Dir(PATH))

If My_File = "" Then
MsgBox "No Files found matching " & PATH & My_Extension
Exit Sub
End If.......

View 9 Replies View Related

Delete Rows With Specific Text In A Column

Apr 16, 2008

I want to delete any/all rows from a worksheet (named UK) which have the word "VAN" in column P. I have tried using a 'For Each... Next statement' in a macro, but always get a debug box "Run Time Error '91' Object variable or With block variable not set". What am I doing wrong? my code follows

Sheets("UK").Select
Dim cell As Range
For Each cell In Worksheets("UK").Range("P10:P200").Cells
Cells. Find(What:="VAN", _
After:=ActiveCell, _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False).Activate
Selection.EntireRow.Delete
Next

View 3 Replies View Related

Find Text In Column & Delete All Rows Below

Jun 10, 2008

I am trying to create a macro that will delete everything below a certain word.

The code I tried to use is the following. This produced an error:

If Range(Cells(1, 1), Cells(180, 1)). Find(" Interest Expense").Row = 0 Then
iStart = Range(Cells(1, 1), Cells(180, 1)).Find(" NET INCOME").Row + 1
Else
iStart = Range(Cells(1, 1), Cells(180, 1)).Find(" Interest Expense").Row + 1
End If
Rows(iStart & ":" & FinalRow).Delete shift:=xlUp

View 4 Replies View Related

Macro To Delete Rows Based On Partial Text

Apr 9, 2009

I am looking for a macro to delete entire rows based on the a partial text contained in column A. For example, I have a list of names that I need to keep but I need to delete the rows in which column A contain cells starting with the following.

BOOKLET 201, PROMO
LOTTO, PRIZE 2
PBT 2, STW WEEK 4

the numbrs in these cells increment therefore I can not make it a specific to the cell but need to select based on Booklet, Lotto and PBT.

View 5 Replies View Related

Delete Rows With Specific Text (multiple Possibilities)

Nov 13, 2013

I need a VBA macro that deletes whole rows if the cell in one of the columns does not match one of three texts. For example, in column B, if the text in there isn't "Mary", "Joseph", or " " (empty space), the row must be deleted.

View 4 Replies View Related

Append Text In One Cell And Delete Duplicate Rows

Jul 14, 2009

I have data that covers multiple rows that I need to merge into one row.

Header:| InvoiceNumber | Type | Name
Row1: | 1000 | Payor | Doe, John
Row2: | 1000 | Payor | Smith, Mary
Row3:| 1000 | Payee| Jones, Henry
Row4:| 1000 | Payee | Jones, Bob

I need to get those four example rows down to one row such as:

Header | InvoiceNumber | Payor | Payee
Row1: | 1000 | Doe, John & Smith, Mary | Jones, Henry & Jones, Bob

The number of payor/payee can vary between 1 and several. I need some way to loop through and keep appending the names in one cell separated by a "&". And then deleting all the duplicate rows (based on InvoiceNumber).

View 9 Replies View Related

Import Multiple Text Files - Delete Rows Between Lines With File Name

Apr 10, 2014

I have around 50 text files with similar design per attached file. I need to import the text files with criteria below:-

1. include file name
2. let user choose the folder
3. exclude data from "work in process summary" to "work in process cost totals"
4. only have one title in the excel files which all text files is combined "Item, Line ....."
5. If the text files do not have title like "Item, Line, ..." do not import

Is it possible to have all criteria listed above by running a macro?

A.txt

View 1 Replies View Related

Delete Columns, Increment Alphanumeric Text, Insert Rows & Sort

Feb 18, 2008

I am having to write a vba code for a survey data captured code online.

I am attaching the code and the vba module that is suupose to do

following things

2) dELETES THE LAST 3 COLUMNS

3) Initial 6 letters from each cell (Q0001=) UPTO (Q00011=)

4)Inserts new row at top from Q1 TO Q11

5) Sorts data on Q6 (Faculty/Staff)

Before all this the i need to insert blank cells for questions that have not been answered and shift the cells right (condition 1) ....

View 9 Replies View Related

Excel 2007 :: VBA Code To Delete Rows Based On Text Starting Content

Oct 25, 2013

Using excel 2007. I am interested in writing a VBA code to delete rows based on the text starting content. I would like to delete rows with cells that do NOT start with an "S" or "SA"

EX:

05S0128
06S0112
05S2298
S25852
S36963
SA36185

I would only like to keep the last 3 lines.

View 3 Replies View Related

Delete & Merge Columns,Delete Rows With Filter, Etc

Jul 15, 2009

1. Remove J,K,N,A Columns,

2. In the last O (TIMESTAMP) column, the date is 14-Jul-09 format change it to 07/14/2009 (this format mm/dd/yyy

3.Filter L column (VAL_INLAKH) Remove all rows from whole sheet which has 0 value

4. Column C (EXPIRY_DT) date format is 24-Sep-09 , "dd-Sep-09" change to "Sep" only

5.Merge Column B,C,D,E (SYMBOL.EXPIRY_DT.STRIKE_PR.OPTION_TYP
respectively )

View 3 Replies View Related

Search For Text Delete This Row And Delete The Row For Every Instance

Apr 29, 2008

I have an formula if statement that returns "deletethisrow" if the test is true.

For every occurence of "deletethisrow" I want to delete the row. The number instances will be variable each time I run the file. So maybe it will find that string, maybe it will find 10 instances. I want to do some kind of loop that won't error out when it cannot find "deletethisrow", but will delete the rows for each instance where it does find this string.

I know it was verbose, but if I just do a loop for a fixed number of loops it will error out if it runs out of rows to delete.

View 9 Replies View Related

Excel 2010 :: Delete Filtered Rows Without Deleting The Hidden Rows?

Sep 25, 2012

How do I delete filtered rows without deleting the hidden rows in excel 2010?

View 8 Replies View Related

Moving Data From Rows To Columns And Delete Repeated Rows

Apr 16, 2014

removing duplicate rows and move other data frm rows to columns.xlsx.

I am attaching a sample excel sheet showing what I need to do.In the first tab, I have a list that includes duplicate rows (first column only). I want to remove those duplicate rows but I don't want to lose the data in the following columns which can be unique or duplicates as well.

see the desired result tab in the sheet to get an idea of what I am looking for as the end result.

Keep in mind that the actual source file I am working with could have up to 50000 row, and the expected results could be around 2000 rows. So nothing can be done manually.

View 5 Replies View Related

How To Delete Copied Rows And Update Original Tab Without Empty Rows

Apr 3, 2014

In my excel I'm copying rows upon specific criteria to another tab.

The question is how I can delete copied rows and update the original tab without empty rows? (N of rows is always changing)

View 14 Replies View Related

Delete The Columns First Then Rows Will Not Delete

May 22, 2008

Is there a limit on the number of rows and columns that can be deleted in a macro on Excel 2003? I am trying to create a macro that, amoung other things, delets 1119 rows and 54 columns. If I delete the columns first, the rows will not delete. If I delete the columns first, the rows will not delete.

View 12 Replies View Related

Consolidate Matching Rows And Delete Duplicate Rows?

Feb 20, 2008

I am working with timesheet data (name, project code, task code, date, hours etc...) in one spreadsheet and rate card data (name, role, day rate etc...) in another.

My task is to pull together some of the information in each of these two source spreadsheets and compile a report. This I have done no problem. However, where a person works on a particular project and task on the same day and records multiple entries (which could be negative) I need to consolidate the hours in all these matching rows and have just one row reflect the total hours worked and delete the other duplicate rows.

So an example would be:

Project | Task | Name | Role | Date | Hours

123456 | 1.001 | Paul Jones | Project Manager | 20/02/2008 | 2.5
123456 | 1.001 | Paul Jones | Project Manager | 20/02/2008 | -2.5
123456 | 1.001 | Paul Jones | Project Manager | 20/02/2008 | 3.5

[Code]....

My problem is I don't think I have approached this the right way but am unsure of where to go with it. The code as is does sort of work but I still get some duplicate and zero lines in my results.

View 4 Replies View Related

Macro To Delete If Set Of Multiple Rows Equals Another Set Of Rows

May 10, 2012

I need a macro that can look at multiple (say three) rows and delete those rows if they match another three rows in the worksheet.

For example:

1 0
3 1
5 7
4 4
6 5
8 3
1 8
5 2
3 9
6 5
8 3
1 8
7 5

If three rows are the same, then one set is deleted (it can be either bottom or top set). I would like to do this for rows 1-500 in the worksheet.

View 1 Replies View Related







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