|
▼はなかっぱ さん:
>国名を、拠点の数分だけ入力し、縦方向に拠点をまとめたい
配列内で入れ替えてみました
Sub Try1() 'Worksheets(1) に元の表 、Worksheets(2)に結果を出力
Dim v
Dim u
Dim i As Long, j As Long, k As Long
With Worksheets(1).Range("A1").CurrentRegion
v = Intersect(.Cells, .Offset(1)).Value
End With
ReDim u(1 To 2, 1 To UBound(v) * UBound(v, 2))
For i = 1 To UBound(v)
For j = 2 To UBound(v, 2)
If IsEmpty(v(i, j)) Then Exit For
k = k + 1
u(1, k) = v(i, 1)
u(2, k) = v(i, j)
Next
Next
Worksheets(2).Range("A1").Resize(k, 2).Value = _
Application.Transpose(u)
End Sub
|
|