I work a lot in spreadsheets that are linked together. Eg I enter data on
one sheet it is recalculated and placed on another spreadsheet that has
multiple rows of data on it. I then delete the lines that have no data from
previous sheet on it to print a neater form. Can I somehow get these rows
that have a zero valu in a certain column not show up when I print instead of
manually deleting them one by one.
Thank You for any help you may be able to give me.
insert this code in a module
you can make a button and assign the macro to the button
when you highlite a range, run the macro and it will delete the empty
rowsSub DeleteBlankRows1()
'Deletes the entire row within the selection if the ENTIRE row contains
no data.
'We use Long in case they have over 32,767 rows selected.
Dim i As Long
'We turn off calculation and screenupdating to speed up the macro.
With Application
.Calculation = xlCalculationManual
.ScreenUpdating = False
'We work backwards because we are deleting rows.
For i = Selection.Rows.Count To 1 Step -1
If WorksheetFunction.CountA(Selection.Rows(i)) = 0 Then
Selection.Rows(i).EntireRow.Delete
End If
Next i
.Calculation = xlCalculationAutomatic
.ScreenUpdating = True
End With
End Sub--
davesexcel
------------------------------------------------------------------------
davesexcel's Profile: www.excelforum.com/member.php...oamp;userid=31708
View this thread: www.excelforum.com/showthread...hreadid=518008This sounds like a good place for using auto filter
select a column which would be blank for the rows you would not want to show
when printing.
Select non blank from the auto filter options.
quot;CarSumquot; wrote:
gt; I work a lot in spreadsheets that are linked together. Eg I enter data on
gt; one sheet it is recalculated and placed on another spreadsheet that has
gt; multiple rows of data on it. I then delete the lines that have no data from
gt; previous sheet on it to print a neater form. Can I somehow get these rows
gt; that have a zero valu in a certain column not show up when I print instead of
gt; manually deleting them one by one.
gt; Thank You for any help you may be able to give me.
- Apr 21 Sat 2007 20:37
How do I delete a row in excel if it has no value?
close
全站熱搜
留言列表
發表留言