Delete Rows Where 2 Cells In Same Row Is Blank
Oct 18, 2006I want to compare the data in column B and C of Row 2 through X (X being up to 20,000), and if BOTH B and C are blank, delete the entire row.
View 4 RepliesI want to compare the data in column B and C of Row 2 through X (X being up to 20,000), and if BOTH B and C are blank, delete the entire row.
View 4 RepliesI need a Macro that will delete rows within a specific range that contain blank cells or preferably delete the rows where the first cell in the row contains a blank cell.
View 9 Replies View RelatedI went to the Macros page and pulled this macro to remove rows if they have blank cells:
Sub DeleteBlankRows2()
'Deletes the entire row within the selection if _
some of the cells WITHIN THE SELECTION contain no data.
On Error Resume Next
Selection.EntireRow.SpecialCells(xlBlanks).EntireRow.Delete
On Error Goto 0
End Sub
I ran this and nothing happened. Does anyone have a fix or perhaps a better way to make this happen?
I would like code that will delete all rows where there are blank cells in Col D from row2 onwards.
View 2 Replies View RelatedI need a VBA to delete rows with blank cells within columns F - AZ
Columns A - E contain headers but also need to be deleted if cells in columns F -AZ are blank.
I have several lists that I need to be able to print out periodically.
The main worksheet that underpins each list is over 900 lines long and numerous calcs and formulae populate columns to provide the data for my 'print lists'.
I need my 'print lists' on seperate worksheets and I have linked the data from my main worksheet results, using IF statements to stop unwanted results being displayed by making the rows appear empty (i.e. to display "").
Due to the design of my main Worksheet it is inevitable that I have many rows in each 'print list' that are not required for that particular 'print list'.
I want to remove the 'empty' rows from the print sheets at the time of printing. I cannot use the GoTo > Special > Blanks > Delete Rows because the rows are not recognised as being 'blank'.
I have attached 2 screenshots of my 'print lists'.
P.S. I am not assuming anything but I have searched on OZGRID and it appears to me that I might need to use Excel/VBA?
I would like a macro that deletes rows based on having two blank cells in adjacent columns. I have achieved this with the following code however i need it to only delete rows below a certain row. How would i achieve this?
Sub DeleteBlankARows()
Dim r As Long
For r = Cells(Rows.Count, 30).End(xlUp).Row To 1 Step -1
If Cells(r, 3) = "" And Cells(r, 4) = "" Then Rows(r).Delete
Next r
End Sub
I have the following codes to delete all blank rows in column A
Dim lastrow As Long
lastrow = Sheet1.Range("A" & Rows.Count).End(xlUp).Row
MsgBox lastrow
With Sheet1
For t = 1 To lastrow
If Cells(t, 1) = "" Then
Rows(t).Delete
End If
Next t
End With
End Sub
Although it is working , it is not deleting all the blank rows at once, I have to keep pressing on the macro button running the macro several times, until all blank rows are completely deleted.
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 RelatedI have been trying to delete about 86k rows in my table in a worksheet. It has been over 5 hours now and it is still running to delete. any better solution? or how long do i need to wait for the system to finish its work?
View 1 Replies View RelatedI have a real problem with a file I'm working on. It has invoice numbers in one column, followed by payment milestones. In the row underneath, there is an 'x' to mark if payment was made in a particular zone, e.g.:
6010136113221/06/201005/07/201022/07/201016/09/2010XXX6010136113313/07/201030/07/201013/08/201014/10/2010XXX
The problem is that there are two rows with data, a blank row, then another two rows with data. I have thousands of rows and need a quick-fix to delete the blanks.
a VBA code to delete blank rows.
The current worksheet has data which is retrieved from other worksheets.
For example:
Current worksheet A1= Sheet1!A1
Current worksheet A10= Sheet2!A1
Current worksheet A20= Sheet13!A1
The range of this current worksheet is A1:F1287 and inbetween there are blank rows. The cells in the current worksheet are not technically blank, because each cell (A1:F1287) retrieves the information from the respective worksheet.
I would like to know of a VBA code to delete a whole blank row/-s (all columns of this row is blank) inbetween the range. Therefore, if there is a whole blank row, this row to be deleted and to go to the next row that shows information . In other words, instead of me manually searching and deleting whole empty rows; a VBA code for this task.
modified my code to have the data continue to the next row where it left off before jump to other sheets. The code below creates too many blank rows of all sheets (9213, 9316, 9501 and 9601).
After the code stops execute, I have to delete all the blank rows. This takes too long, approximately 5 minutes for each sheet...
I am trying to write a macro that will check from 1 to 143 columns..and if all the columns are empty then it has to delete that entire line. Totals rows are over 35000. I am using excel 2007. I have written the below code. Could someone pl help me in enhancing this.. or a better way as this is taking about an hour to complete.
Sub Costa()
Dim i As Long
Dim j As Integer
j = 2
For i = 2 To 37735
loop1: For j = j To 143
If Cells(i, j) = "" Then
j = j + 1
GoTo loop1
Cells(i, j).EntireRow.Delete
Else
j = 2
GoTo loop3
End If
Next j
Cells(i, j).EntireRow.Delete
loop3: Next i
End Sub
I can count the blank cells withiin a range using
=COUNTBLANK(C6:AD2506)
But I dont want it to count the cells if the entire row, within that cell, i.e. C6:AD6, is blank.
It should only count the blank cells within a row if there has been some data entered on that row..provided it has been entered within the specified range.
I need to detect blank rows and then delete them but for the formula not be be affected
In the example attached there are 4 components but i may only need to use 3 so row 4 would be blank
i need to find the blank rows and delete them and for the formula in cells G12:H14 to be update as necessary
at the moment if i delete the rows i get a REF# in place of the cell which has been deleted
i have tried this on a simple formula and when you delete a row the formula changes as required
I've got a code that generates some worksheets in a fairly large workbook. The code is run monthly and replaces the already existing worksheets.
The problem is that each newly generated worksheets contains more than 1 million rows, which means that the size of each worksheet is around 5MB.
I need a code which allows me to delete all blank rows starting with row 1000 in those worksheets.
I have created a file where I use the Subtotal function. Once I collapse the information to only give me the Total, I would like to copy the Total rows into another worksheet. However, when I do this I get blank lines in between. I am trying to find a way to delete the blank rows in between the Total rows I need. Is there a way to do this with the auto filter function?
View 1 Replies View RelatedI would like VBA code to delete all rows where there are blanks in Col B
View 2 Replies View RelatedI need to loop through data when it finds a blank it need to delete that row and 15 rows down and loop through whole data set find blank row and delete 15 rows down.
It's been years since I did any VBA, and I forgot. Do I need to use offset to acheive this task?
I need to write a macro that will successfully delete blank rows. I also need to write a macro that will successfully delete duplicates. The duplicates are numbers and they do constantly change.
View 9 Replies View RelatedA macro that will delete a tab or tabs in a file if and only if rows 11, 13, 23 & 25 are completely blank within that tab?
So basically ALL rows would need to be blank, if there is any data within any of those rows, then tab should NOT be deleted.
I need a macro to delete blank rows from row 2, but excluding the last 4 rows where there is blank rows between the data
See example below where the rows containing blank cells after #2 in column A must not be deleted ...
I have a spreadsheet that has 4 columns and column D has some blanks randomly down the sheet. How can I delete any and all rows that have a blank in column D?
When I tried this code on excel at home it worked, but now i'm at work and it dosen't delete any rows at all!
Here's the ....
How can I delete all blank rows in a spreadsheet without sorting the data as I want it to be in the exact order it is in.
View 5 Replies View RelatedI am trying to delete rows that do not have values in column B. This is a quote form that takes up over 1000 rows but not all are needed (ie lines that do not have any value in B "qty"). Is there a way do have excel delete these without doing it manually?
View 3 Replies View RelatedI have command button in Sheet 3 (from where I will be running the macro) and I need a macro which will delete all the blank columns and rows in the data containing in Sheet 1.
View 2 Replies View RelatedI have data input in a particular column, say Column C.
I would like to have a macro that deletes the rows where the corresponding entry in Column C are blank.
In addition, there are multiple worksheets with the same data format in the same spreadsheet, but the number of row varies. It would be great if the macro can delete the row with blank cell in that column across all worksheet.
I've added a button with a macro to delete any blank rows in a worksheet.
Cell A3 is completely blank and A6 has an IF formula which returns "". In my macro it copies the whole worksheet and then paste special values, to take away the formula in A6 and then deletes the blank rows but it still does not delete row 6.