delete blank and shift up

excelV

New Member
Joined
Mar 19, 2011
Messages
8
I'm trying to go down every column and delete blanks by pasting up but I think I have an error in my coding. I have a date associated with number so I actually have to shift up two columns for every cell but I think the problem lies with the IsEmpty Cell Function.

If anyone has another way to approach this please reply, thank you.


If IsEmpty(ActiveCell.Select) Then
ActiveCell.Offset(0, -1).Range("A1").Select
Selection.End(xlUp).Select
ActiveCell.Offset(2, -1).Range("A1").Select
ElseIf IsEmpty(Active.Offset(0, 1).Range("A1").Select) Then
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Cut
ActiveCell.Offset(-1, 0).Range("A1").Select
ActiveSheet.Paste
ActiveCell.Offset(-2, 1).Range("A1").Select
ActiveCell.Offset(1, 0).Range("A1").Select

End If
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
21,286
Office Version
  1. 365
  2. 2007
Platform
  1. Windows
Hi
Seems a little odd that you would need to delete and shift up in "every" column.
I would this may cause all sorts of errors.
Maybe you could post a sample of what you have and what you would like as the end result.
Have a look at the 2nd line of my tag for a copy of a free HTML maker. This will allow you to download a sample of your data
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,604
Messages
5,838,326
Members
430,538
Latest member
PedroOliveira

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top