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
 

Some videos you may like

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
19,281
Office Version
  1. 2013
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
 

Watch MrExcel Video

Forum statistics

Threads
1,109,541
Messages
5,529,436
Members
409,877
Latest member
DDhol
Top