Thanks for the lesson in forum etiquette and the solution.
It worked (sort of).
There appeared to be an issue if there were multiple blank cells.
The code I am using is...
Sub createConfig()
Application.ScreenUpdating = False
' Determine where to dave the config file
configFile = Range("save_location").Value & Range("saved_file_name")
' Open the file for output
fnum = FreeFile()
Open configFile For Output As fnum
' Determine which config sheet to export
Dim configType As String
configType = "DNS"
' Now go to that config sheet and get the data and dump to file
Sheets(configType).Select
lastRow = Range("D65535").End(xlUp).Row
Range("D16").Select
Do While ActiveCell.Row <= lastRow
If Not IsEmpty(ActiveCell) Then
output = ActiveCell.Value
Print #fnum, output
End If
ActiveCell.Offset(1, 0).Select
Loop
' Close the file
Close #fnum
Sheets("DNS").Select
Application.ScreenUpdating = True
SaveMsg = "DNS Configuration file saved to " & configFile & vbNewLine & vbNewLine
MsgBox Prompt:=SaveMsg, Title:="Configuration Compilation Complete"
End Sub
The result I get is...
DnsCmd dc1ns-ad01.hc.int RecordAdd hc.int MNTESTRT01 /CreatePTR A 10.192.1.1
DnsCmd dc1ns-ad01.hc.int RecordAdd hc.int MNTESTRT01-CE /CreatePTR A 10.190.1.45
DnsCmd dc1ns-ad01.hc.int RecordAdd hc.int MNTESTRT01-PE /CreatePTR A 10.190.1.46
DnsCmd dc1ns-ad01.hc.int RecordAdd hc.int MNTESTRT01-VLAN1 /CreatePTR A 10.1.1.254
DnsCmd dc1ns-ad01.hc.int RecordAdd hc.int MNTESTSW01 /CreatePTR A 10.1.1.240
I have cell entries in d17-d20,d22,d36
I appreciate your assistance.
Hopefully I got the formatting correct this time.
ReeceB
Bookmarks