|
▼まくら さん:
なんだか美しくないコードですが、参考程度で宜しければ。
意味を履き違えていたらすみません。
Sub まくら()
Dim myStr As String
Dim i As Long, n As Long, lastRow1 As Long, lastRow2 As Long
With ThisWorkbook.Worksheets("Sheet1")
lastRow1 = .Range("A" & Rows.Count).End(xlUp).Row
For i = 1 To lastRow1
myStr = .Range("A" & i).Value
n = .Range("B" & i).Value
With ThisWorkbook.Worksheets("Sheet2")
lastRow2 = .Range("A" & Rows.Count).End(xlUp).Offset(1).Row
If .Range("A1").Value = "" Then
.Range("A1", "A" & n).Value = myStr
Else
.Range("A" & lastRow2).Resize(n, 1).Value = myStr
End If
End With
Next i
End With
End Sub
|
|