Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default macro to delete empty cells

Sub RemoveEmptyCells_ShiftUp()
Application.ScreenUpdating = False
Application.Calculation = xlManual
Dim rw As Long, iCol As Long
For rw = ActiveSheet.UsedRange.Rows.Count To 1 Step -1
If isempty(cells(rw,1)) Then _
cells(rw,1).Delete Shift:=xlShiftUp
Next
Application.Calculation = xlAutomatic
Application.ScreenUpdating = True
End Sub

This deletes blank cells in Column A ( second argument of cells is 1) and
shifts the cell up.

--
Regards,
Tom Ogilvy


"Todd" wrote in message
...
Hi, I am playing with a marcro to delete empty cells. I
have a macro that deletes empty rows and I thought I could
basically change "rows" to "cells" and it would work. But
I guess its not that simple. Can someone tell me what I
need to make this work?

TIA

Todd.

Here is the origonal macro.

Sub RemoveEmptyRows()
Application.ScreenUpdating = False 'xlManual below in
Xl95
Application.Calculation = xlCalculationManual
Dim rw As Long, iCol As Long
For rw = ActiveSheet.UsedRange.Row.Count To 1 Step -1
If Application.CountA(Rows(rw).Entirecell) = 0 Then _
Rows(rw).Delete
Next
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True 'xlAutomatic above
in xl95
End Sub



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
delete row if 2 cells are empty Wanna Learn Excel Discussion (Misc queries) 1 November 19th 09 10:20 PM
delete cells column. Delete empty cells myshak Excel Worksheet Functions 0 March 9th 09 10:59 PM
How do I delete rows where cells are empty Stan Excel Discussion (Misc queries) 2 January 2nd 08 05:49 AM
Delete Empty Cells in a Macro fak119 Excel Discussion (Misc queries) 3 January 9th 07 04:58 PM
Delete Row If Empty Macro Richard Excel Discussion (Misc queries) 3 January 20th 06 11:26 PM


All times are GMT +1. The time now is 12:33 PM.

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

About Us

"It's about Microsoft Excel"