[英]Copy & Paste Cell Value “X” amount of times then loop to next row
细节:
Dim StartRow As Byte
Dim LastRow As Long
Dim i As Integer
Dim ii As Integer
Dim cnt As Integer
StartRow = 3
LastRow = Range("B3").CurrentRegion.Rows.Count - 1
For i = StartRow To LastRow
cnt = Range("C" & i).Value
For ii = 1 To cnt
If Range("B" & StartRow) = 1 Then
Range("D" & StartRow).Copy
Range("B" & StartRow).End(xlToRight).Offset(0, ii + 2).PasteSpecial (xlPasteAll)
End If
Next ii
Next i
你可以试试这个:
Dim StartRow As Byte
Dim LastRow As Long
Dim i As Integer
Dim ii As Integer
Dim cnt As Integer
Dim limitCol As Integer
StartRow = 3
LastRow = Range("B3").CurrentRegion.Rows.Count - 1
For i = StartRow To LastRow
If (CInt(Range("B" & i)) = 1) Then
cnt = Range("C" & i).Value
limitCol = cnt + 6
For ii = 7 To limitCol
Cells(i, ii) = Range("D" & i).Value
Next ii
End If
Next i
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.