Sub ShiftValuesLeft()
Dim iRows As Integer, iCols As Integer, x As Integer, y As Integer, icount As Integer
Dim MyArray(), rTop As Range
iRows = Range("Top").CurrentRegion.Rows.Count
iCols = Range("Top").CurrentRegion.Columns.Count - 1
Set rTop = Range("Top")
ReDim MyArray(iRows, iCols)
For x = 1 To iRows
For y = 1 To iCols
If rTop.Cells(x, y) <> "" Then
MyArray(x, icount) = rTop.Cells(x, y)
icount = icount + 1
End If
Next y
icount = 0
Next x
For x = 1 To iRows
For y = 1 To iCols
If MyArray(x, icount) <> "" Then
Range("Output").Cells(x, y) = MyArray(x, icount)
icount = icount + 1
End If
Next y
icount = 0
Next x
End Sub
Bookmarks