#1   Report Post  
Posted to microsoft.public.excel.setup
Mindie
 
Posts: n/a
Default Delete rows with no data

I have an excel spreadsheet that I would like it to automatically look at
columns of data and if there is no data or formulas for that column of data
to go ahead and delete the column or if I have it in a row to delete the row.
Is there an easy way to do this?

  #2   Report Post  
Posted to microsoft.public.excel.setup
Gord Dibben
 
Posts: n/a
Default Delete rows with no data

Mindie

This would require VBA macro to be "automatic"

Sub DeleteEmptyRows()
Dim LastRow As Long
''only if entire row is blank
LastRow = ActiveSheet.UsedRange.Row - 1 + _
ActiveSheet.UsedRange.Rows.Count
Application.ScreenUpdating = False
For r = LastRow To 1 Step -1
If Application.CountA(Rows(r)) = 0 Then Rows(r).Delete
Next r
End Sub

Sub DeleteEmptycolumns()
Dim Lastcolumn As Long
''only if entire column is blank
Lastcolumn = ActiveSheet.UsedRange.Column - 1 + _
ActiveSheet.UsedRange.Columns.Count
Application.ScreenUpdating = False
For r = Lastcolumn To 1 Step -1
If Application.CountA(Columns(r)) = 0 Then Columns(r).Delete
Next r
End Sub


Gord Dibben Excel MVP

On Wed, 30 Nov 2005 11:49:08 -0800, Mindie
wrote:

I have an excel spreadsheet that I would like it to automatically look at
columns of data and if there is no data or formulas for that column of data
to go ahead and delete the column or if I have it in a row to delete the row.
Is there an easy way to do this?


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
Macro to delete rows with same data Connie Martin Excel Worksheet Functions 12 November 22nd 05 01:18 PM
Loading Column Data with blank Rows into Data Validation Box ExcelMonkey Excel Worksheet Functions 3 October 13th 05 06:09 PM
Pivot Table - max rows allowed in data range dmotika Excel Discussion (Misc queries) 2 May 26th 05 05:52 PM
hOW TO DELETE THE - IN (23-HFV51), I HAVE LOTS OF ROWS WITH DATA. KimSingh Excel Discussion (Misc queries) 2 March 21st 05 07:04 PM
Pulling data from 1 sheet to another Dave1155 Excel Worksheet Functions 1 January 12th 05 05:55 PM


All times are GMT +1. The time now is 11:11 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"