0

使用 Excel VBA,我正在尝试创建自定义序列。如何继续自定义序列的 IP 地址范围为:10.168.187.0 - 10.168.187.100?

我到目前为止的代码发布在下面。

Sub Sequence()
'
' Sequence Macro
' Macro recorded 13/02/2013 by Don
'
' Keyboard Shortcut: Ctrl+Shift+M
'
Range("A1").Select
ActiveCell.FormulaR1C1 = "10.168.187.0"
Range("A2").Select
ActiveCell.FormulaR1C1 = "10.168.187.1"
Range("A3").Select
ActiveCell.FormulaR1C1 = "10.168.187.2"
Range("A4").Select
End Sub
4

1 回答 1

1

Assuming that you're looking to automate the completion of the cells, the following should work:

Sub CompleteRange()

For i = 1 To 101

    Cells(i, 1) = "10.168.187." & (i - 1)

Next i

End Sub
于 2013-02-13T22:32:00.453 回答