how to delete emtpy

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

TrustPilot

starstarstarstarstar Excellent

  • Home
  • Courses
  • Promotions
  • Schedule
  • Formats
  • Our Clients

Forum home » Delegate support and help forum » Microsoft Excel Training and help » HOW TO DELETE EMTPY CELLS

HOW TO DELETE EMTPY CELLS

resolvedResolved · Medium Priority · Version 2007

Suyeon has attended:
Excel Advanced course
Excel VBA Intro Intermediate course
Access Advanced course

HOW TO DELETE EMTPY CELLS

How can i delete empty cells in vba? empty random cells going down? thanks

RE: HOW TO DELETE EMTPY CELLS

Hello Suyeon

Here's a way using the For Each command.

Highlight the cells including the black cells first.
Then if the cell is empty it is deleted (with shift cells up)

Sub DeleteBlanks()
Dim myCell As Range

For Each myCell In Selection

myCell.Select
If myCell.Value = "" Then
myCell.Delete Shift:=xlUp
End If

Next myCell

End Sub

Please let me know if it works, thanks.

Regards
Doug Dunn
Best STL

Wed 25 Jul 2012: Automatically marked as resolved.


 

Excel tip:

Closing all your workbooks Quickly

Hold the SHIFT key down and using the mouse click on the file menu, it will now now CLOSE ALL rather than close. This closes all workbooks down but still leaves the application open.

View all Excel hints and tips


Server loaded in 0.1 secs.