|
▼nima papa さん:
>VBAの組み方がわかりません
こんにちは。
Sheet1から結果をSheet2に出しています。
Sub TBL_SET()
Dim i As Long
Dim j As Long
Dim k As Long
Dim varT As Variant
Dim varR() As Variant
varT = Worksheets("Sheet1").Range("A1").CurrentRegion
ReDim varR(1 To UBound(varT) * UBound(varT, 2), 1 To 3)
For i = 1 To UBound(varT)
For j = 2 To UBound(varT, 2)
If varT(i, j) <> Empty Then
k = k + 1
varR(k, 1) = varT(i, 1)
varR(k, 2) = varT(i, j)
End If
Next
Next
With Worksheets("Sheet2")
.Cells.ClearContents
.Range("A1").Resize(k, 2).Value = varR
End With
End Sub
|
|