我需要在另一列的行中转置一行文本,如下所示: (需要在相关的第2行[此处为A2至E3]时间将A1复制到E1文本)
A B C D E F
1 Ab1 Ab2 Ab3 Ab4 Ab5 Total
2 3 2 1 3 1 10
3
4 Ab1
5 Ab1
6 Ab1
7 Ab2
8 Ab2
9 Ab3
10 Ab4
11 Ab4
12 Ab4
13 Ab5
答案 0 :(得分:0)
这将遍历Row1
Sub Move_It()
Dim sh As Worksheet
Dim col As Long
Dim rng As Range
Dim c As Range, x, y
Set sh = Sheets("Sheet1") 'actual name of worksheet
With sh
col = .Cells(1, .Columns.Count).End(xlToLeft).Column
Set rng = .Range(.Cells(1, 1), .Cells(1, col))
For Each c In rng.Cells 'loop through row 1
x = c.Offset(1)
For y = 1 To x
.Cells(.Rows.Count, "A").End(xlUp).Offset(1) = c
Next y
Next c
End With
End Sub
答案 1 :(得分:0)
您可以将其录制为宏。