|
こんにちは。
テストシートで試してみてください。
Sub test()
Dim rowA As Long
Dim i As Long, k As Long
Dim m2 As Long
Dim m3 As Long
Dim m4 As Long
Dim vntA, vntB
rowA = Range("A65536").End(xlUp).Row
ReDim vntA(1 To rowA - 1, 1 To 16)
vntB = Range("A2").Resize(rowA - 1, 16).Value
For i = 2 To Range("A65536").End(xlUp).Row
m2 = 5
m3 = 9
m4 = 13
For k = 1 To Cells(i, "Q").End(xlToLeft).Column
Select Case vntB(i - 1, k)
Case 0 To 1
vntA(i - 1, k) = vntB(i - 1, k)
Case 2
vntA(i - 1, m2) = 2
m2 = m2 + 1
Case 3
vntA(i - 1, m3) = 3
m3 = m3 + 1
Case 4
vntA(i - 1, m4) = 4
m4 = m4 + 1
End Select
Next k
Next i
Range("A2").Resize(rowA - 1, 16).Value = vntA
End Sub
|
|