Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1310
  • Last Modified:

VBA to delete all empty cells and move up in usedrange

Hi

i have data and i want to get rid of all empty cells in each columns. i need vba to delete empty cells in columns and move up.

then i have another sheet that also i need delete empty cells but this time move to the left.

thanks.
0
Flora
Asked:
Flora
  • 4
  • 3
1 Solution
 
Martin LissRetired ProgrammerCommented:
Sub DeleteMoveUp()

    ActiveSheet.UsedRange.SpecialCells(xlCellTypeBlanks).Delete Shift:=xlUp
End Sub

Open in new window

Sub DeleteMoveLeft()

    ActiveSheet.UsedRange.SpecialCells(xlCellTypeBlanks).Delete Shift:=xlToLeft
End Sub

Open in new window

0
 
FloraAuthor Commented:
I love you Martin.  this is magic
0
 
Martin LissRetired ProgrammerCommented:
I love you Martin.
It's a good thing my wife isn't a jealous woman:)

In any case I'm glad I was able to help.

In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2014
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
FloraAuthor Commented:
Thanks Martin.

your profile is impressive.  I liked the Using the Debugger  article.  it is so helpful.
0
 
Martin LissRetired ProgrammerCommented:
If you want to you can give it a Helpful vote.
0
 
FloraAuthor Commented:
surely i can and i will
0
 
Martin LissRetired ProgrammerCommented:
Thanks.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now