0

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
1
  • 1
    Formula: ="10.168.187." & ROW()-1 (starting in A1) Commented Feb 13, 2013 at 22:38

1 Answer 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
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks Dom that has worked exactly how need it. I'm very new to VBA so appreciate the help :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.