Option Explicit
Sub TransposeColumn()
Dim sh1 As Worksheet, sh2 As Worksheet
Dim i As Long, n As Long
Dim LastRow As Long
Dim Row1 As Long
Dim Row2 As Long
Dim Count1 As Long
Dim Count2 As Long
Set sh1 = Sheets("Sheet1")
Set sh2 = Sheets("Sheet2")
sh2.Cells.ClearContents
Row2 = 2
Count2 = 1
sh1.Select
LastRow = Cells(Rows.Count, "G").End(xlUp).Row
Row1 = LastRow
Count1 = Cells(LastRow, 7)
Range("A" & LastRow - Count1, "F" & LastRow - Count1).Select
Selection.Copy
Sheets("Sheet2").Select
Sheets("Sheet2").Range("A2").Select
ActiveSheet.Paste
For n = 7 To Count1 + 6
Sheets("Sheet2").Cells(Row2, n).Select
Sheets("Sheet2").Cells(Row2, n) = Count2
Count2 = Count2 + 1
Next n
Count2 = 1
sh1.Select
Do Until ActiveCell.Address = sh1.Range("A2").Address
Cells(LastRow, 7).Select
Count1 = Cells(LastRow, 7)
For i = LastRow To Count1 Step -1
If Cells(LastRow, 7) = "" Then
LastRow = LastRow - 1
Count1 = Cells(LastRow, 7)
sh2.Rows("2:2").Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Row1 = LastRow
Count1 = Cells(LastRow, 7)
Range("A" & LastRow - Count1, "F" & LastRow - Count1).Select
Selection.Copy
Sheets("Sheet2").Select
Sheets("Sheet2").Range("A2").Select
ActiveSheet.Paste
For n = 7 To Count1 + 6
Sheets("Sheet2").Cells(Row2, n).Select
Sheets("Sheet2").Cells(Row2, n) = Count2
Count2 = Count2 + 1
Next n
Count2 = 1
sh1.Select
Exit For
Else
Cells(LastRow, 7).Select
LastRow = LastRow - 1
End If
Next i
Loop
sh2.Select
sh2.Range("A1").Select
sh1.Select
Range("A1").Select
Application.CutCopyMode = False
End Sub