Sub CombineColumnsVertically()
Dim ws As Worksheet
Dim sourceRange As Range, targetRange As Range
Dim col As Integer, targetRow As Long
Set ws = ThisWorkbook.Sheets("Sheet2") ' シート名を適宜変更
Set sourceRange = ws.Range("A1:C9") ' 取得したいデータの範囲を設定
Set targetRange = ws.Range("D1") ' 結果を縦に並べる開始セルを指定
targetRow = 0
For col = 1 To sourceRange.Columns.Count
targetRange.Offset(targetRow, 0).Resize(sourceRange.Rows.Count, 1).Value = sourceRange.Columns(col).Value
targetRow = targetRow + sourceRange.Rows.Count
Next col
End Sub
More than 1 year has passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme