Thread: vba
View Single Post
Old 05-02-2008, 04:27 PM   #1
gl45
Grade 1
 
Join Date: Jun 2005
Posts: 878
vba

Anyone,
why this code isn't working:

Sub Blank()
Range("B3:HZ14").SpecialCells(xlCellTypeBlanks).Delete Shift:=xlToLeft
End Sub

I'm trying to delete all the blank cells in the sheet (Range B3:HZ14), and move the data to the left, in order to have a continuous cells that contains only data, to be specific:

b=Blank cell
D=Data cell

Before delete
B C D E F (columns)...etc.
3 b b b b D D D b
4 D b D b b D D D
5 b b b b b b D b
6 D D D D D D D b
7 b b D D b b b b

After delete
B C D E F (columns)...etc.
3 D D D
4 D D D D D
5 D
6 D D D D D D D
7 D D

The workbook already contains macro that only effect the first sheet. The above macro does work with the first sheet named BOX, but I need the macro to work on a sheet named OUT.
Anyone VBA guru?
Thanks
lbj
gl45 is offline   Reply With Quote