次のように(あなたが後にした正確な形式であなたにそれを与える)VBAの答えは次のとおりです。
:答えは、今あるコメントで改正要件を考えると
Sub DigitBlocks()
Dim rng As Range, a As Double, b As Double, c As Double, d As Double, e As Double
Set rng = ActiveSheet.Range("A2").CurrentRegion
a = Val(Right(Left(rng.Address, InStr(rng.Address, ":") - 1), Len(Left(rng.Address, InStr(rng.Address, ":") - 1)) - InStrRev(Left(rng.Address, InStr(rng.Address, ":") - 1), "$"))) + 1
b = 3
For d = a To rng.Rows.Count
Range("E" & b).Value = Range("A" & d).Value
e = Range("B" & d).Value
For c = 1 To e
Range("F" & b + c - 1).Value = c
Next c
b = b + c
Next d
End Sub
Sub DigitBlocks() Dim rng As Range, a As Double, b As Double, c As Double, d As Double, e As Double Set rng = ActiveSheet.Range("A2").CurrentRegion a = Val(Right(Left(rng.Address, InStr(rng.Address, ":") - 1), Len(Left(rng.Address, InStr(rng.Address, ":") - 1)) - InStrRev(Left(rng.Address, InStr(rng.Address, ":") - 1), "$"))) + 1 b = 3 For d = a To rng.Rows.Count Range("M" & b).Value = Range("J" & d).Value e = Range("K" & d).Value For c = 1 To e Range("N" & b + c - 1).Value = c Next c b = b + c Next d End Sub
VBAでは非常に簡単です。それはオプションですか? –
ビジュアルの基本私ははいを得ることができます。どのように確かではありません。それはまだフォーマットをExcelにエクスポートするのだろうか? –
はい、列Aと列Bにあるものをループして、E&Fに値を追加するだけです。同じExcelファイルに含まれています。 –