D
DavidJ726
I've been searching on how to remove blank rows and have come up with a
couple of solutions. Back on August 21, JulieD posted the following answer
to the thread, Delete all blank rows in sheet?
Highlight a column....Edit>Go To>Special>Blanks>OK. Delete>Entire Row. it
will work, but you must highlight a COLUMN not a ROW
This process works fine for a manual process, but I was hoping for something
more automated.
On 09/23, Frank posted this response to the thread Removing blank rows?
http://www.cpearson.com/excel/deleting.htm#DeleteBlankRows
This seemed like what I was after, although to be honest I'm not
understanding everything in the macro. I thought I inserted the macro into
my personal.xls, but when I run it on a test worksheet by selecting
Tools/Macro/Macros, I don't get any results. BTW... it is showing up as:
personal.xls!DeleteRows. This seems to be normal as another macro I have in
my personal.xls shows up (and works) in the same manner.
So I guess my question is, is there something "special" that I can't
remember doing, or don't know, that needs to be done to make sure the macro
is working properly? Or maybe the following macro really isn't what I'm
looking for?
Basically, all I'm doing is deleteing blank rows. I have a digital
thermometer with probes that are reading the temperatures in a roasting
oven. The meter has a RS-232 port and I can export the recorded data to a
*.xls worksheet. However there are blank rows in the worksheet I want to
delete before I use or export the data in another worsheet. There are
several columns that have data such as the date, time, type of probe,
temperature, etc... and all I want/need to do is delete the blank rows.
The macro looks like this, other than changing the 1st line as indicated
below, I made no other change.
Any help on what I'm doing wrong is appreciated,
David...
This was the original 1st line that I modified. Basically removed public &
changed the macro name
Public Sub DeleteBlankRows()
Sub DeleteRows()
' This macro deletes duplicate rows in the selection. Duplicates are
' counted in the COLUMN of the active cell.
Dim Col As Integer
Dim r As Long
Dim C As Range
Dim N As Long
Dim V As Variant
Dim Rng As Range
On Error GoTo EndMacro
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Col = ActiveCell.Column
If Selection.Rows.Count > 1 Then
Set Rng = Selection
Else
Set Rng = ActiveSheet.UsedRange.Rows
End If
N = 0
For r = Rng.Rows.Count To 1 Step -1
V = Rng.Cells(r, 1).Value
If Application.WorksheetFunction.CountIf(Rng.Columns(1), V) > 1 Then
Rng.Rows(r).EntireRow.Delete
N = N + 1
End If
Next r
EndMacro:
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
couple of solutions. Back on August 21, JulieD posted the following answer
to the thread, Delete all blank rows in sheet?
Highlight a column....Edit>Go To>Special>Blanks>OK. Delete>Entire Row. it
will work, but you must highlight a COLUMN not a ROW
This process works fine for a manual process, but I was hoping for something
more automated.
On 09/23, Frank posted this response to the thread Removing blank rows?
http://www.cpearson.com/excel/deleting.htm#DeleteBlankRows
This seemed like what I was after, although to be honest I'm not
understanding everything in the macro. I thought I inserted the macro into
my personal.xls, but when I run it on a test worksheet by selecting
Tools/Macro/Macros, I don't get any results. BTW... it is showing up as:
personal.xls!DeleteRows. This seems to be normal as another macro I have in
my personal.xls shows up (and works) in the same manner.
So I guess my question is, is there something "special" that I can't
remember doing, or don't know, that needs to be done to make sure the macro
is working properly? Or maybe the following macro really isn't what I'm
looking for?
Basically, all I'm doing is deleteing blank rows. I have a digital
thermometer with probes that are reading the temperatures in a roasting
oven. The meter has a RS-232 port and I can export the recorded data to a
*.xls worksheet. However there are blank rows in the worksheet I want to
delete before I use or export the data in another worsheet. There are
several columns that have data such as the date, time, type of probe,
temperature, etc... and all I want/need to do is delete the blank rows.
The macro looks like this, other than changing the 1st line as indicated
below, I made no other change.
Any help on what I'm doing wrong is appreciated,
David...
This was the original 1st line that I modified. Basically removed public &
changed the macro name
Public Sub DeleteBlankRows()
Sub DeleteRows()
' This macro deletes duplicate rows in the selection. Duplicates are
' counted in the COLUMN of the active cell.
Dim Col As Integer
Dim r As Long
Dim C As Range
Dim N As Long
Dim V As Variant
Dim Rng As Range
On Error GoTo EndMacro
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Col = ActiveCell.Column
If Selection.Rows.Count > 1 Then
Set Rng = Selection
Else
Set Rng = ActiveSheet.UsedRange.Rows
End If
N = 0
For r = Rng.Rows.Count To 1 Step -1
V = Rng.Cells(r, 1).Value
If Application.WorksheetFunction.CountIf(Rng.Columns(1), V) > 1 Then
Rng.Rows(r).EntireRow.Delete
N = N + 1
End If
Next r
EndMacro:
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub