Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I find a blank row and delete it?
I import data from a source and it has 1 blank row between rows of data and
notes. I need a routine that will find that blank row and delete it and move the remainder of the information up. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I find a blank row and delete it?
Hi,
Assuming you determine blank rows by capturing all blank cells in column A: Sub test() Dim rg As Range, rgBlank As Range '-------- CHANGE HERE ----------- Set rg = ActiveSheet.Range("A:A") '-------------------------------- 'get blank cells from rg On Error Resume Next Set rgBlank = rg.SpecialCells(xlCellTypeBlanks) On Error GoTo 0 If rgBlank Is Nothing Then 'no blank cell MsgBox "No Blank cells found" Else 'else delete entire rows rgBlank.EntireRow.Delete End If End Sub -- Regards, Sébastien <http://www.ondemandanalysis.com "lpdarspe" wrote: I import data from a source and it has 1 blank row between rows of data and notes. I need a routine that will find that blank row and delete it and move the remainder of the information up. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I find a blank row and delete it?
Sébastien, Thank you very much! It did what I needed!
"sebastienm" wrote: Hi, Assuming you determine blank rows by capturing all blank cells in column A: Sub test() Dim rg As Range, rgBlank As Range '-------- CHANGE HERE ----------- Set rg = ActiveSheet.Range("A:A") '-------------------------------- 'get blank cells from rg On Error Resume Next Set rgBlank = rg.SpecialCells(xlCellTypeBlanks) On Error GoTo 0 If rgBlank Is Nothing Then 'no blank cell MsgBox "No Blank cells found" Else 'else delete entire rows rgBlank.EntireRow.Delete End If End Sub -- Regards, Sébastien <http://www.ondemandanalysis.com "lpdarspe" wrote: I import data from a source and it has 1 blank row between rows of data and notes. I need a routine that will find that blank row and delete it and move the remainder of the information up. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I find a blank row and delete it?
Sub DeleteRows()
ActiveSheet.UsedRange.Select X = ActiveSheet.UsedRange.Columns.Count Selection.AutoFilter For i = 1 To X Selection.AutoFilter Field:=i, Criteria1:="=" Next X = ActiveSheet.UsedRange.Count Range("A2:G" & X & "").Delete End Sub "lpdarspe" wrote: I import data from a source and it has 1 blank row between rows of data and notes. I need a routine that will find that blank row and delete it and move the remainder of the information up. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Find First Non blank cell than find column header and return that value | Excel Worksheet Functions | |||
"Last Cell" to find last row, but can't delete blank rows | Excel Discussion (Misc queries) | |||
find and delete duplicate entries in two columns or find and prin. | Excel Programming | |||
Delete blank row only if 2 consecutive blank rows | Excel Programming | |||
Find and Delete Blank Cells Formatted as Text | Excel Programming |