Question: Can I write a VBA or python code to do the below

Answer Well, I don´t know if you can write it, but it's writeable :)
If you want to have the address in one column and work only with that column you will have to do some string manipulation in your code, having as reference the dots in the strings.
Or you can have a column with each one of the octect and then concatenate them with the dots in another column. This way you won't have to do string manipulation or even code at all, maybe you can solve it only formulas.
I have data that looks like this for IP addresses: for security reasons I am writing made up numbers here.




Subnet 1
Subnet 2
Site




5.22.128.0
17
Texas


5.22.0.0
17
Boston


etc
etc
etc




Question: Can I write a VBA or python code to do the below:
to take each Subnet 1 and:  if the third octet is 128 then add 127 rows below it and fill them as such:




Subnet 1
Subnet 2
Site




5.22.128.0
17
Texas


5.22.129.0
17
Texas


5.22.130.0
17
Texas




.... all the way to:




Subnet 1
Subnet 2
Site




5.22.255.0
17
Texas




And if the third octet is 0 then do the same thing but from 0 to 127. while keeping the other data intact (Site and Subnet 2) the same.
I didn't really know where to begin so I don't have code but my thinking was:
either:
A. Change the decimals to commas to represent figures in millions then add a summation calc until it reaches certain numbers.
B.Create two lists one from 0-127 and one from 128-255 and then append them to the values on the columns but I still don't know how to get multiple rows for it.
I am fairly new but if there is anything wrong with the way the question is presented please let me know. - don't care if it is done through VBA or python as I can write both - Just need a direction as to how to start.
Is there a way in python or Excel to duplicate rows and add a value to a certain column - explanation below