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 how to run through a table an delete the empty cells?

if not, and as stated it isn't, then you can use this

Sub Test()
Dim rng As Range
Set rng = Columns(1).SpecialCells(xlCellTypeBlanks)
Set rng = Intersect(rng.EntireRow, Range("A:B"))
rng.Delete shift:=xlShiftUp
End Sub

to just delete the cells in columns A and B where the cell in A is blank.

--
Regards,
Tom Ogilvy


"Dave Ramage" wrote in message
...
This should be about the quickest way, as long as it is
acceptable to delete the entire row. Select the cells in
column A then run it.

Sub Test()
Selection.SpecialCells(xlCellTypeBlanks).EntireRow .Delete
End Sub

Cheers,
Dave
-----Original Message-----
I need to write a macro to run through a list of values

in column A and
B.

If column A is blank, then I have to delete cells A and B
correspondingly.

Is it very difficult to do that?


---
Message posted from http://www.ExcelForum.com/

.



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 to delete at once empty columns in a table? capxc Excel Discussion (Misc queries) 1 July 19th 08 08:28 PM
How do I delete rows where cells are empty Stan Excel Discussion (Misc queries) 2 January 2nd 08 05:49 AM
delete rows with empty cells Slohcin Excel Discussion (Misc queries) 14 December 19th 06 05:14 PM


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