Formerly Best Training
© 2024 STL. All Rights Reserved.
All prices offered for business users and exclude VAT. E&OE
2nd Floor, CA House, 1 Northey Street, Limehouse Basin, London, E14 8BT. United Kingdom
Forum home » Delegate support and help forum » Microsoft Excel Training and help » HOW TO DELETE EMTPY CELLS
Resolved · Medium Priority · Version 2007
Suyeon has attended:
Excel Advanced course
Excel VBA Intro Intermediate course
Access Advanced course
How can i delete empty cells in vba? empty random cells going down? thanks
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 QuicklyHold 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. |
We'll call during UK business hours
Server loaded in 0.1 secs.