Code:
For Each cell In [Data!a5:a279999]
If cell.EntireRow.Hidden = False Then
pm_name = cell.Offset(0, 7)
'define variables values in subroutine def_Vars
def_Vars
'catch end of document to exit loop
If pm_name = "" Then
Exit For
End If
'write the placemark info to file #1
'if account is not parent then write folder closing statements to kml and set trigger to only write it once
'then write as child folder output
If pm_par = 0 Then
write_folderClose
End If
write_pmOutput
Next cell
'write footer to file
Print #1, "</folder>"
Print #1, "</Document>"
Print #1, "</kml>"
Close #1
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
the write_folderClose sub is to write a one time bit of code to close out a kml folder (for google earth)
Code:
Sub write_folderClose()
If parent_Trigger = True Then
Print #1, "</folder>"
Print #1, "<folder><name>Child Accounts</name><open>0</open>"
Else
parent_Trigger = False
End If
End Sub
the write_pmOutput sub has nothing more in it than a bunch of print statements to write the KML code for a bunch of variables collected from the spreadsheet.
it befuddles me as to how i'm losing the for/next relationship...any thoughts? This macro is failing to compile because of a next without for error. i'm STUMPED
Last edited: