Sub to transform table into cols
Hi Max
The code below would be one way of doing it or should hopefully give
you an idea of one way to do what your looking for
Option Explicit
Dim MyCell, MyRng As Range
Dim LstRow, LstCol, i, Cntr As Integer
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Sheets(1).Activate 'Change to your reference sheet "V"??
LstRow = [A1].End(xlDown).Row
Set MyRng = Range("A2", "A" & LstRow)
For Each MyCell In MyRng
i = 1
Cntr = 1
MyCell.Activate
LstCol = ActiveCell.End(xlToRight).Column
Do While Cntr < LstCol
ActiveCell.Offset(0, 1).Select
ActiveCell.Copy
Sheets(2).Activate 'Change to your destination sheet
[A6596].End(xlUp).Offset(1, 0).Activate
ActiveCell = MyCell
ActiveCell.Offset(0, 1).PasteSpecial
(xlPasteValues)
ActiveCell.Offset(0, 1) = i
i = i + 1
Cntr = Cntr + 1
Sheets(1).Activate
Loop
Next MyCell
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub
Hope it helps
S
|