Solved

VBA to delete all empty cells and move up in usedrange

Posted on 2014-11-12
7
824 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 47

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 6

Author Closing Comment

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

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
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!

 
LVL 6

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 47

Expert Comment

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

Author Comment

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

Expert Comment

by:Martin Liss
ID: 40442966
Thanks.
0

Featured Post

Technology Partners: 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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

749 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