嵌套循环的作品。问题 - 我不知道如何使循环移动到下一个单元格(B11:B20);它只是将值重写到范围(B1:B10)。我的想法是我可能不需要嵌套循环,但我无法解决解决方案。
Sub insertNum()
Dim sheetOne As Worksheet
Set sheetOne = Worksheets("Sheet1")
Dim i, j As Long
For i = 1 To sheetOne.UsedRange.Rows.Count
For j = 1 To 10
Select Case j
Case 1 To 5
sheetOne.Cells(j, 2).Value = "2"
Case 6 To 10
sheetOne.Cells(j, 2).Value = "3"
End Select
Next j
Next i
End Sub