编程技术网

关注微信公众号,定时推送前沿、专业、深度的编程技术资料。

 找回密码
 立即注册

QQ登录

只需一步,快速开始

极客时间

Excel VBA自定义序列:Excel VBA Custom Sequence

X-Frox 序列 2022-5-11 10:49 6人围观

腾讯云服务器
Excel VBA自定义序列的处理方法

使用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)!

腾讯云服务器 阿里云服务器
关注微信
^