Delete Row If Range Is Blank
Oct 3, 2008
I need a bit of code that will delete a row if a range in the row is all blank
ie, if all cells in range between I and AZ are blank then delete the row
I also need this to happen from row 5 downwards as top 4 rows are headers etc.
I have been trying to modify this piece of code but with no luck
Dim fn As WorksheetFunction
Dim rngDelete As Range
Set fn = Application.WorksheetFunction
Set rngDelete = Range("I1:AZ1")
NumberOfRows = Range("a10000").End(xlUp).Row
For x = NumberOfRows To 1 Step -1
With rngDelete
If fn.CountA(.Offset(x, 0)) = 0 Then .Offset(x, 0).EntireRow.Delete
End With
Next x
View 9 Replies
ADVERTISEMENT
Jun 23, 2014
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.
View 14 Replies
View Related
Feb 23, 2010
I 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.
View 9 Replies
View Related
Jun 6, 2014
I have multiple tables like the one in the picture and have to duplicate this code for different known ranges.
View 11 Replies
View Related
Jul 15, 2008
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.
View 14 Replies
View Related
Sep 2, 2009
I have spent several hours searching the forum but have not been able to find any code that I could tailor to my specific need.
Basically, when I press a button on a 'Util' sheet, I need to cut every row on the 'Source' sheet with 'Closed' in column 'B', paste the rows to the next blank row on the 'Closed_Requests' sheet, and delete the resulting blank row from the 'Source' sheet.
View 8 Replies
View Related
Apr 9, 2014
I've got some code set up to add a row above any row containing the word "Task" . I've realised that in some cases there is already an empty row, so I don't want a second blank row. How can I change the code to say add a row, unless the row is already blank?
this is the code:
Option Explicit
Sub emma()
Dim lr As Long
lr = Range("A" & Rows.Count).End(xlUp).Row
Dim i As Long
[code].....
View 4 Replies
View Related
Jan 21, 2010
I have the following code which i have adapted. I used it to Hide blank Rows but now i wish to delete the row:
View 4 Replies
View Related
May 5, 2007
I have data ranging from A1..AF2001 . The problem is that every second row i.e. a2, a4 and so on is a blank row. Please provide me the macro to delete every second blank rows at once.
View 9 Replies
View Related
Jun 17, 2014
I 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 Related
Mar 13, 2014
i want delete row E&F depends upon blank cells in range of F:F column...though vba
View 6 Replies
View Related
Oct 21, 2009
My range is A2:T600 on one single worksheet. In many cells, the first character is a blank space (a mistake of mine when creating the initialize code in the user form into which the info was entered). I only need to do this once ever for this worksheet, but I hate to go through them all by hand. So what I need is to select the range, and IF the first character of a cell is a blank space, delete just that character.
View 3 Replies
View Related
Nov 20, 2011
Up till now I have been using the code posted not realising it fails in certain conditions, The data in column A can contain what look like blanks but are not and therefore do not get removed. Can any tell how to get around this problem, as wish to delete those as well
Code:
Sub GetRidOfBlanks()
Dim RO As Integer
' GetRidOfBlanks Macro
' Macro recorded 21/07/2011 by Peter Hayward
'
' Keyboard Shortcut: Ctrl+Shift+B
[Code]...
View 1 Replies
View Related
Jan 19, 2012
I 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.
View 1 Replies
View Related
Feb 23, 2013
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.
View 9 Replies
View Related
Jul 16, 2014
I've recorded and edited a macro for a worksheet I have, but there is one function I can't figure out - if it can even be done.
My sheet has 134,000 rows of data extending to column AS but, in column K, I have approximately 9 - 10,000 empty cells. I need to delete the entire row of data where there is an empty cell in column K. Can this be written into the macro?
View 6 Replies
View Related
May 9, 2007
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...
View 9 Replies
View Related
Sep 3, 2007
I have data in a workbook which has blank cells in columns D and E. What im trying to find out is the a macro that will delete the row if the cells are blank in both columns D and E right the way down the workbook.
View 9 Replies
View Related
Apr 24, 2009
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
View 9 Replies
View Related
Feb 24, 2010
How i can delete blank cells. I have more rows like example below ....
View 9 Replies
View Related
Apr 18, 2013
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
View 5 Replies
View Related
Apr 16, 2014
i want to delete entire row if Column C2:C1000 are blank
e.g if range c2:c100 have data then delete the rows C101:C1000
View 3 Replies
View Related
Oct 31, 2008
I d like to find a method with which I can delete records from E starting from E2 that have 0 or even blanks with a macro.
View 9 Replies
View Related
Jan 14, 2012
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 Related
Aug 30, 2012
I have written such loop which I want to delete entire row when a given cell is empty:
Code:
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
For Counter = lastrow To 2 Step -1
If Cells(Counter, 6).Value = "" Then
Selection.Rows(Counter).EntireRow.Delete
End If
Next
It works not the way I want. It has ommited some blank rows and also removes 5th row everytime I run it.
View 3 Replies
View Related
Nov 13, 2012
I would like VBA code to delete all rows where there are blanks in Col B
View 2 Replies
View Related
Sep 11, 2013
I 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?
View 6 Replies
View Related
May 14, 2014
VBA codes in filtering blanks.
Here is a screenshot, and what i want to do is to delete the entire row that has a blank cell. In which here, the 5th row, 7th row and 9th row.
View 5 Replies
View Related
Jun 20, 2014
I need a code that will delete an entire column (J) if J6 is blank.
View 3 Replies
View Related
Jul 23, 2007
I am using the following macro to delete "completely empty" rows. I also need to delete some rows if a cell in column B has no value. How would I change this macro?
' DeleteBlankRows
Dim r As Long
Dim C As Range
Dim Rng As Range
On Error GoTo EndMacro
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
If Selection.Rows.Count > 1 Then
Set Rng = Selection
Else
Set Rng = ActiveSheet.UsedRange.Rows
End If
For r = Rng.Rows.Count To 1 Step -1
If Application.WorksheetFunction.CountA(Rng.Rows(r).EntireRow) = 0 Then
ActiveSheet.Rows(r).EntireRow.Delete
End If
Next r
EndMacro:
View 9 Replies
View Related