If I've set of data like this in Ms Excel
10.0.0.1-10.0.0.3
172.16.0.3
192.168.0.2-192.168.0.2
How do I expand those IP Address and produce an output like this?
10.0.0.1
10.0.0.2
10.0.0.3
172.16.0.3
192.168.0.2
iNZyC.png
If I've set of data like this in Ms Excel
10.0.0.1-10.0.0.3
172.16.0.3
192.168.0.2-192.168.0.2
How do I expand those IP Address and produce an output like this?
10.0.0.1
10.0.0.2
10.0.0.3
172.16.0.3
192.168.0.2
iNZyC.png
Put your data in column A starting at A1.
Then run this Macro
![]()
Sub Test() LR = Cells(Rows.Count, 1).End(xlUp).Row Data = Application.Transpose(Range("A1:A" & LR).Value) For Count = 1 To UBound(Data) If InStr(1, Data(Count), "-") > 0 Then A = Split(Data(Count), "-") If A(0) = A(1) Then Output = Output & ", " & A(0) Else myBase = Left(A(0), InStrRev(A(0), ".")) For Count2 = Split(A(0), ".")(3) To Split(A(1), ".")(3) Output = Output & ", " & myBase & Count2 Next End If Else Output = Output & ", " & Data(Count) End If Next If Len(Output) > 2 Then Output = Mid(Output, 3) Temp = Split(Output, ",") Range("B1:B" & UBound(Temp) + 1).Value = Application.Transpose(Temp) End Sub
My General Rules if you want my help. Not aimed at any person in particular:
1. Please Make Requests not demands, none of us get paid here.
2. Check back on your post regularly. I will not return to a post after 4 days.
If it is not important to you then it definitely is not important to me.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks