Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
CarSum
 
Posts: n/a
Default How do I delete a row in excel if it has no value?

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.
  #2   Report Post  
Posted to microsoft.public.excel.misc
davesexcel
 
Posts: n/a
Default How do I delete a row in excel if it has no value?


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
rows


Sub 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: http://www.excelforum.com/member.php...o&userid=31708
View this thread: http://www.excelforum.com/showthread...hreadid=518008

  #3   Report Post  
Posted to microsoft.public.excel.misc
bj
 
Posts: n/a
Default How do I delete a row in excel if it has no value?

This 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.

"CarSum" wrote:

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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to delete multiple autoshape or objects in excel ron Excel Discussion (Misc queries) 4 January 26th 06 11:01 PM
delete multiple autoshapes or objects in excel ron Excel Discussion (Misc queries) 3 January 26th 06 03:01 PM
Delete excel spreadsheets within excel gemnnsw Excel Discussion (Misc queries) 1 January 13th 06 10:13 PM
I WANT TO DELETE A WIDE OF DATE IN A EXCEL FILE Wing Excel Discussion (Misc queries) 1 November 25th 05 02:38 AM
How can we delete rows permanently from excel sheet Nehal Shah Excel Discussion (Misc queries) 1 August 1st 05 01:58 PM


All times are GMT +1. The time now is 04:57 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"