只有当我从 A22-78 中选择并 ctrl C 行时,此宏才有效。我希望它在我不必这样做的情况下工作。此函数从 (#rows)*(每行中的#columns) 中生成一列
Sub RowsToColumn()
Dim RN As Range
Dim RI As Range
Dim r As Long
Dim LR As Long
Dim WS As Worksheet
Set WS = Sheets.Add
Application.ScreenUpdating = False
Columns(1).Insert
r = 0
LR = Range("B" & Rows.Count).End(xlUp).Row
For Each RN In Range("B22:B" & LR)
r = r + 1
For Each RI In Range(RN, Range("XFD" & RN.Row).End(xlToLeft))
r = r + 1
Cells(r, 1) = RI
RI.Clear
Next RI
Next RN
Columns("A:A").SpecialCells(xlCellTypeBlanks).Delete Shift:=xlUp
Application.ScreenUpdating = True
End Sub
感谢你