Delete Rows Based On Condition Of 1 Column

Oct 19, 2007

I would like to Use my Excel VBA program to search each row in a csv document for a name (located in a cell ) if the name exists then I would like to delete the entire row.

Whenever I try to do the above in excel, even when I save in csv format the file formating or something gets changed and the file which has to be procesed through another program then process incorectly.

Is there a way to do what I need while retaining the formating which must obviously be changed when the file is opened in excel?

View 9 Replies


ADVERTISEMENT

Delete Rows Based On A Condition

Jul 20, 2009

Is it posibile to make a macro that automaticaly delete rows based ona a condition. Condition is to delete rows that have B column value "" or zero. For example:....

View 12 Replies View Related

Delete Rows Based On Condition

Jul 3, 2007

complete this coding?

Sub DeleteBlankRowInColumnA()
'this macro scrolls down Column A if the cell is empty the row is deleted.
Dim A As Integer
A = 0
Do Until A = 142
If Range(0, "a1") = 0 Then
Selection.Delete shift:=xlUp
End If
Loop

End Sub

View 9 Replies View Related

Code To Delete Rows Based On Condition

Apr 24, 2009

I have an Excel spreadsheet that is given to me weekly, but I'd like to remove repetitive and empty rows before presenting it to someone. It is set up like this:

Row 1, A1, contains the word Project.
Row 2 is blank
Row 3 is blank
Row 4 is blank
Row 5, A5, contains the word Organization.
Row 6 is blank
Row 7, A7, contains a 6-digit number starting with 3.
Row 8 is blank

(all of the above starts over again (loops) approximately 30 times)
The final row contains the phrase "Grand Total"

*Row 5 is repetitive and is not required. I'd like to delete it.

I have too many empty columns. Getting rid of them (and Row 5) would greatly shorten my spreadsheet.
I am aiming for:
Project
301111

Project
301112

Project
301110
(Repeat until finished)

Grand Total:

View 4 Replies View Related

Delete Rows Based On Condition In Another Workbook

Aug 28, 2007

I have a worksheet with part numbers, and I want to delete all the rows with part numbers matching a part number in another workbook (I could import the list into the part number workbook in a new sheet if it makes it easier). The part numbers in the other worksheet would be in column A.

View 5 Replies View Related

Delete Rows In Closed Workbook Based In Condition?

Mar 1, 2013

Having book1 and book2 (that is closed). Is there a way that if I erase a value "X" in book 1, update book2 (without open it) deleting the complete row/rows where the value X is found?

View 4 Replies View Related

Selecting Rows Based On A Column Condition

Jun 4, 2009

I have a worksheet which is created monthly by one of our company's employees which reports results for that months operations and successful audits. These audits are separated into various service lines and on the report which is submitted it takes on the following format:


1|Service Line|Data A|Data B|Etc.
2|___CR_______| Data | Data | Etc.
3|____________| Data | Data | Etc.
4|____________| Data | Data | Etc.
5|____________| Data | Data | Etc.
6|___DD_______| Data | Data | Etc.
7|____________| Data | Data | Etc.
8|___MS_______| Data | Data | Etc.
9|____________| Data | Data | Etc.

What I want to do is use a macro from another sheet that has the effect of: While ServiceLine = "CR" copy the row of that line and move it to my monthly summary workbook, sheet 1. Then when the Service line changes to DD have the macro copy that information to the monthly summary workbook sheet 2, and so on. The problem is, if I test the Service Line column each time it will be an empty string the majority of the time and I'm not sure how to combat that with my If, Do, For, and While statements. As I've thought about it there are two solutions that I can think of: someone knows of a way to test the row only if it has information in it, or if there is a way that I can copy the service line information down until the change in service line so I can test Service Line on each Row.

View 3 Replies View Related

Exclude Rows Based On Condition In 1 Column

Feb 7, 2009

I have a worksheet that I want to export to a csv file. However, there are multiple rows that I want excluded in the export. These lines are recognized by the word "No" in column E. Is this possible?

View 3 Replies View Related

Vba To Delete Rows Based On Certain Conditions In Column A

Mar 2, 2006

I have a report in which I need to delete the entire row for each cell in Column A that has the name "Defacto" in a certain location in that cell. I am trying to use VBA code in conjuction with the "MID" function [i.e., Mid(Cell.Value, 8, 7) = "Defacto"]. This is the code I came up with (but, obviously, it doesn't work):

Sub DeleteRowOnCondition()
Range("A2").Select
Range(ActiveCell, ActiveCell.End(xlDown)).Select
For Each Cell In Selection
If Mid(Cell.Value, 8 , 7) = "Defacto" Then Rows.Delete
Next Cell
End Sub

As well, there is another worksheet in the same report in which I need to delete all the rows that do NOT meet that condition (while retaining the ones that do).

View 9 Replies View Related

Delete Non Numeric Rows Based On Column

Mar 12, 2008

The attached picture shows part of an excel file. It contains about 50.000 rows which I want to run a pivot on. The problem is though that the file contains some rows which stop my pivot from running correctly. These data which I mention are in rows 4, 7, 22-25. Seeing as deleting them manually would take me hours and hours I was wondering if there would be a macro which I can run which delete rows automatically. I think it should filter on the following: whenever there is not a numeric value in column A, the entire row should be deleted.

View 6 Replies View Related

Delete Rows Based On Flag In Column

Mar 14, 2008

I want to get a Macro to delete all rows wherever "DELETE" appears in a certain column - I tried using the Delete Entire Row Based on Criteria Macro on Ozgrid but I'm looking for a fully automated solution, rather than the question boxes coming up and asking which cell/criteria to use. The spreadsheets I'm using this on are big, so because this Macro uses filters, it takes a long time and I also need to run this macro on multiple sheets so its not practical to use this.

DELETE is just the word I'm using as the TRUE statement generated from an IF formula that I'm using to compare cells in adjacent rows ie =IF(AND(E2=E3,G2=G3,Q2=Q3),"DELETE",FALSE) - Its completely fine for me to copy/paste values of this formula first and then sort the column so that all cells containing DELETE will appear at the top of the column if that helps. Any ideas on how I could get a Macro to delete those rows at this stage?

View 9 Replies View Related

Delete Rows Based On Date Column

May 10, 2008

modifying the following from deleting rows older than 365 days to delete rows older than 12 months. So I can keep a rolling year by month.

Sub DeleteOldSR()
Dim x As Long
Dim iCol As Integer

Application. ScreenUpdating = False

iCol = 7 'Filter on column G (Create Date)

For x = Cells(Cells.Rows.Count, iCol).End(xlUp).Row To 2 Step -1
s = Cells(x, 3).Value
If s Like "Closed" Or s Like "Closed w/o Customer Confirm" Then
If Cells(x, iCol).Value < (Date - 365) Then
Cells(x, iCol).EntireRow.Delete
End If
End If
Next

Application.ScreenUpdating = True

End Sub

I tried modifying the IF statement using month with the following but it seems to delete all months < and is not year dependant.

If Month(Cells(x, iCol).Value) < Month(Date) - 12 Then

View 6 Replies View Related

Delete Duplicate Rows Based On 1 Column

Jun 12, 2008

creating a macro for an excel spreadsheet? The problem I am faced with is I need to reduce a xls file from a ticketing system at work that contains roughly 50,000 rows.

What I need to have done is reduce a Site Code column (column B) so that for each ticket entry there is only one occurrence of each user that worked on that ticket.What the macro should do is to look through column B and remove any duplicate rows for the same ticket number located in column A. once the macro gets to the next ticket number in column A I need it to start over on the duplicate check for column B.

I have a attached a xls file to this post to try and show what it is i am working on.

View 8 Replies View Related

Delete Rows Based On Seperate Column Data

Nov 29, 2006

How can I delete an entire row based on seperate column data? Example: I want Excel to look at cell A2 and cell E2. If the values are the same I want Excel to delete row 2.

View 4 Replies View Related

Delete Blank Rows & Rows Below Meeting Condition

Jun 21, 2008

I have an imported report in a spreadsheet. It imports to three columns. I need to check each row in column A for three seperate criteria and delete the rows I don't need. I need to delete blank rows and check next row for page header info. Delete these and next rows to next blank cell. Check next row for page header and not delete if not page header. Several rows down will be a cell with 23 blank spaces before the word Reg: and sometimes other words past this but always this first. This row is to be kept. I looked at the FAQ's example of Deleting but I don't think it will work. I also need to put a key word in column A at a point where I want to stop. This report is a couple thousand rows long so a VBA procedure would really save time. I have a procedure I use to check for two zero's in two cells that hide these rows but I couldn't modify it to work on this report.

View 9 Replies View Related

How To Delete Rows Based On Whether Or Not A Cell In Column B Is Empty Or Null

Jun 23, 2014

I am building a template ("Table") that will import data from 4 other spreadsheets and then format the data once its all in the template. I need to delete all rows where a name didn't import. The names are landing in column B (starting with B22), so I set up my code using an active cell loop macro to examine each cell to see if it was empty, and then to delete the row if it were. I've tried 4-5 iterations of code but nothing is working correctly.

Apparently when the fields are copied over from the other spreadsheets, some empty cells actually have something in them such that they are not completely blank. What syntax I can use so that I capture every instance of a blank/empty cell and delete that corresponding row? Some of the code I've tried is below.

[Code] .....

View 3 Replies View Related

Search Column Bottom Up Then Delete Rows Based On Value Found

Jul 7, 2009

I've attached a dummy worksheet that shows constant values of 1.00 in columns D and E. In the actual workbook, user action will sometimes cause these values to change to something other that 1.00. The user may wish to delete the action that caused the change.

I need a macro that will search from the last cell in column D upward to the first instance of a cell that is not equal to 1.00 and select that cell and those immediately above with the same value as the first found cell.

For example, in the attached worksheet the search would start in the last cell of Columd D and search upward. It would find cell D23 and upward to D19. These entire rows would be deleted.

View 5 Replies View Related

Delete Duplicate Rows Based On Cell/column Values?

Oct 28, 2009

I have a excel file which contains dublicate rows. The duplicate rows can be identified based on few cell/column values. I need a macro to delete the duplicate rows when the below condition is satisfied: let us consider row 5 and row 6:

If column 7,12,13,16,17,18,19,23,24,27,28,29,30 in row 5 = row 6 then row 6 has to be deleted. This condition has to be followed for all other rows in the excel used range. Have attached the sample workbook.

View 5 Replies View Related

Delete Rows Based On Criteria While Referencing Column Header

Jun 6, 2007

I'm trying to use VBA code to delete certain rows based on a couple of criteria as follows:

1) If column header is "TERMINAL NAME" and the cell value in that column is "BONDDESK", I need the entire row deleted.

2) Similiarly, if the column header is "PRODUCT TYPE" and the cell value in that column is "CORP", that entire row needs deleted as well.

The information is coming from another source, so the columns may change from day to day, i.e, "TERMINAL NAME" may be in Column L one day but in Column O another day.....

View 6 Replies View Related

Delete Rows When The Condition Is Met...

Oct 6, 2008

I'm working this spreadsheet and i want to automate of deleting the entire rows once the last two columns contains both Zero values. the worksheet cotains thousands of row to clean-up.

View 3 Replies View Related

Delete Rows If Condition Not Met

Dec 15, 2009

I want a macro to delete the entire row based on the value in Column Q ....

View 14 Replies View Related

Macro To Delete Rows With A Condition

May 28, 2009

What I need is a macro to delete a row or rows for a specific range of cells (eg. E20 to E58) when the cells in that range column E is = blank. The cells in column E is formated with a currency sign $. Deleting the row should shift up all rows below. I need to run this macro manually. Excel 2002 SP3.

View 9 Replies View Related

Macro To Delete Rows If A Certain Condition Is Met

Jan 6, 2009

I want to create a macro the will delete all the rows in a sheet if 1 of 2 conditions are met. The first condition is if a cell is blank or if a cell contains the word "negative"

View 9 Replies View Related

Delete Duplicate Rows With Condition

Nov 1, 2006

how to delete duplicate rows except the first and the last rows using macro..

I have data like this and i want to delete those rows except the first and the last rows

31/10/2006
31/10/2006
31/10/2006
31/10/2006

I use the below macros from btadams posted 27th January 2003 but only for delete the last row

Sub DleteDups()
Dim Cell As Range

Do While ActiveCell.Offset(1, 0) <> ""
If ActiveCell.Value <> ActiveCell.Offset(1, 0).Value Then
ActiveCell.Offset(1, 0).Select
Else
ActiveCell.EntireRow.Delete
End If
Loop
End Sub

View 9 Replies View Related

Delete A Row Based On Condition

Dec 14, 2009

I want to delete a row in excel based on a condition.

The condition is as follows:

I have few rows in the excel where the columns 7,12,13,23 are same and column 24 in one row has some number and in some other row the column 24 is blank with orange color filled(the colorindex for orange is 44).

In this case I want the row with orange color filled in column 24 to be deleted.

View 11 Replies View Related

Delete Row Based On Condition

Jan 19, 2007

i have an issue i need to delete entire row if a condition is met, i need syntax if possible to delete if a cell word "begins with" a certain letter ...in this case...letter A

column is "O"
must search threw entire row

View 3 Replies View Related

Delete And Sum Duplicate Rows With Multiple Condition

Oct 31, 2012

Here is the problem: i have two conditions to satisfy first is data from column A and second is data from column C, what i wanted to do is if both data from column A and B has the same other data in column A and C then sum the total in column D, F, I retain data for column B, E, G and H. Then delete the duplicate rows. By the way we also need to replace the remove the text (W1,W2,W3,W4 and W5) in column C.

View 6 Replies View Related

Macro To Delete Rows That Fill Certain A Certain Condition

Jun 25, 2007

How do I have the marco delete rows if the O column = a certain cell.

For instance my O column has a bunch of colors

Cell N1 list one color (red) and I want the macro to delete the rows that contain the color from N1 in column "O".

View 9 Replies View Related

Delete Rows When Meet Criteria Or Condition

Nov 21, 2006

I have a spreadsheet with 3023 rows and columns A-L. Here's a small sampling of Column A (with heading "sku" included, copied exactly as it appears in the spreadsheet):

A
sku
3102-0400-100000
3102-0400-200000
3102-0500-100000
3102-0500-200000
3102-0600-100000
3102-0600-200000
3102-0700-100000
3102-0700-200000

I need to delete every row in which column A includes the text "200000".

Although the above sampling shows "200000" appears in every other row, that is not the case in all 3023 rows.

View 9 Replies View Related

VBA To Delete Entire Row Based On Condition Met?

Jun 16, 2014

I have table in which against the Column A data values are added in Column B, C and D.

If Column B,C and D cell values is 0, then I want entire row including A to be deleted. How can I do this in VBA?

Note: Column A data begins from Row 15 and below.

Just to avoid confusion. I want row deletion, only when all the three cell on B,C and D is = 0

View 7 Replies View Related







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