macrosfunction增加EXCEL单元格的值

我是Excel中的macros编程新手。

到目前为止,我能够创build一个转向的程序

10.10.10.1 10.10.10.2 10.10.10.3 10.10.10.4 

 10.10.10.1 10.10.10.1 10.10.10.1 10.10.10.1 10.10.10.1 10.10.10.2 10.10.10.2 10.10.10.2 10.10.10.2 10.10.10.2 

具体如下:

 Sub CopyData() Dim lRow As Long Dim RepeatFactor lRow = 1 Do While (Cells(lRow, "A") <> "") RepeatFactor = 5 If ((RepeatFactor > 1) And IsNumeric(RepeatFactor)) Then Range(Cells(lRow, "A"), Cells(lRow, "B")).Copy Range(Cells(lRow + 1, "A"), Cells(lRow + RepeatFactor - 1, "B")).Select Selection.Insert Shift:=xlDown lRow = lRow + RepeatFactor - 1 End If lRow = lRow + 1 Loop End Sub 

但现在,我正在尝试将每个IP地址的第三个八位字节增加到一定数量,然后重复。

这是我有什么:

在这里输入图像说明

这就是我想要的:

在这里输入图像说明

请告诉我什么function,我应该谷歌….

而不是使用macros,这可以通过使用单元格公式(UDF),只是将其复制下来解决。

 A1 = 10 B1 = 10 C1 = 10+MOD(ROW(),4) D1 = 0+INT(ROW()/4) E1 = A1 & "." & B1 & "." & C1 & "." & D1 

然后复制A1:E1向下….

(注意:避免macros!macros违反电子表格的function特性,不透明(不可见数据是如何处理的),通常很复杂(只是尝试从别人那里读取代码)等等)