title: Macro functions to increment value of EXCEL cells
body: <p>I am new to Macro programming in Excel.</p>
  
  <p>So far, I was able to create a program that turns</p>
  
  <pre><code>10.10.10.1
  10.10.10.2
  10.10.10.3
  10.10.10.4
  </code></pre>
  
  <p>into </p>
  
  <pre><code>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
  </code></pre>
  
  <p>with the following:</p>
  
  <pre><code>Sub CopyData()
  Dim lRow As Long
  Dim RepeatFactor
  
      lRow = 1
      Do While (Cells(lRow, "A") &lt;&gt; "")
  
          RepeatFactor = 5
          If ((RepeatFactor &gt; 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
  </code></pre>
  
  <p>But now, I am trying to increment the third octet of each IP address up to a certain number, and then repeat.</p>
  
  <p>Here is what I have: </p>
  
  <p><img src="https://i.stack.imgur.com/ytIfV.png" alt="enter image description here"></p>
  
  <p>And here is what I would like:</p>
  
  <p><img src="https://i.stack.imgur.com/w2ECr.png" alt="enter image description here"></p>
  
  <p>Please tell me what functions I should google .... </p>