CrystalStart
IS-IT--Management
I am using this code to flip data from starting at column 2 to the end of data.
It works a treat.
But recently I need to start not only at column 2 but also at Range A5 of column 2.
Do you see how to alter this code to make it work?
lColumnCount = Sheets(i).[B:B].CurrentRegion.Columns.Count
If lColumnCount = "" Then
MsgBox "There is no data."
Exit Sub
End If
Application.ScreenUpdating = False
iStart = 2
iEnd = lColumnCount
Do While iStart < iEnd
vTop = Selection.Columns(iStart)
vEnd = Selection.Columns(iEnd)
Selection.Columns(iEnd) = vTop
Selection.Columns(iStart) = vEnd
iStart = iStart + 1
iEnd = iEnd - 1
Loop
THANKS TO ALL
It works a treat.
But recently I need to start not only at column 2 but also at Range A5 of column 2.
Do you see how to alter this code to make it work?
lColumnCount = Sheets(i).[B:B].CurrentRegion.Columns.Count
If lColumnCount = "" Then
MsgBox "There is no data."
Exit Sub
End If
Application.ScreenUpdating = False
iStart = 2
iEnd = lColumnCount
Do While iStart < iEnd
vTop = Selection.Columns(iStart)
vEnd = Selection.Columns(iEnd)
Selection.Columns(iEnd) = vTop
Selection.Columns(iStart) = vEnd
iStart = iStart + 1
iEnd = iEnd - 1
Loop
THANKS TO ALL