使用Excel VBA,我正在尝试创建自定义序列.如何为范围为10.168.187.0-10.168.187.100的IP地址继续自定义序列?
Using Excel VBA, I am trying to create a custom sequence. How can I continue a custom sequence for a range of IP Addresses ranging from: 10.168.187.0 - 10.168.187.100?
我到目前为止的代码发布在下面.
The code I have so far is posted below.
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
假设您要自动执行单元格的完成,则应该可以进行以下操作:
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
这篇关于Excel VBA自定义序列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程技术网(www.editcode.net)!