Solved

VBA to delete all empty cells and move up in usedrange

Posted on 2014-11-12
7
770 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 46

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 46

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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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 46

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 46

Expert Comment

by:Martin Liss
ID: 40442966
Thanks.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to reset cell styles? 15 26
copy same as above data 18 38
Cost allcocation ... 10 23
best way to protect an excel questionnaire 5 30
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…
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 will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

838 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