Hi,
The following codes selected range H1:J13 -
then I want to (remove blank cells, and) shift non-blank cells to the right (range H1:J13);![]()
Sub test() 'created by NORMAN JONES: http://www.44342.com/MS-EXCEL-f84-t68546-p1.htm Cells(1, Columns.Count).End(xlToLeft)(1, 1).Select End Sub Sub sce() 'CREATED BY PastorMike: http://www.excelbanter.com/showthread.php?t=297162 Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select 'keyboard shortcut: shift+ctrl+end: http://www.excelbanter.com/showthread.php?t=297162 'ps. sometimes code select more than last non-blank cell... :( End Sub Sub whole() Call test Call sce End Sub
below code shift non-blank cells to left:
How it will look a code to shift cells to the right?![]()
Sub DeleteEmptyCells() Selection.SpecialCells(xlCellTypeBlanks).Delete shift:=xlToLeft End Sub
ps. see the attach
Bookmarks