Solved

VBA to delete all empty cells and move up in usedrange

Posted on 2014-11-12
7
646 Views
Last Modified: 2014-11-14
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
Comment
Question by:Flora
  • 4
  • 3
7 Comments
 
LVL 45

Accepted Solution

by:
Martin Liss earned 500 total points
ID: 40438177
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
 
LVL 5

Author Closing Comment

by:Flora
ID: 40438932
I love you Martin.  this is magic
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40438962
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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 5

Author Comment

by:Flora
ID: 40439005
Thanks Martin.

your profile is impressive.  I liked the Using the Debugger  article.  it is so helpful.
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40439012
If you want to you can give it a Helpful vote.
0
 
LVL 5

Author Comment

by:Flora
ID: 40442501
surely i can and i will
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40442966
Thanks.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now