|re: Here is one version, the rest do not have the missing Host:. |
For the one offs, why not just fix them manually?
It would probably take longer to write the code than to just fix them yourself, unless you have a huge number of them.
Once that is fixed and is set up like all the others that you want to reformat, this code should do it.
Note: I suggest you run this code in a backup copy of your workbook. Macros can not be undone and this code will delete lines.
It assumes that there is nothing that you need to the right of Hosts: server_name since it deletes those rows after moving the strings down.
'Determine last row with data in Column A
lastRow = Range("A" & Rows.Count).End(xlUp).Row
'Start at bottom of list:
For rw = lastRow To 1 Step -1
'Each time we find the string "Host:" put "Host:"
'in the cell below it, copy the server name below that
'and then delete the "Host: Server Name" row
If Cells(rw, 1) = "Host:" Then
Cells(rw + 1, 1) = "Host:"
Cells(rw + 2, 1) = Cells(rw, 2)