'This script searches the BLN file using the BLN flag value in 'Column B and then automatically enters the correct number of points 'in the header line in Column A. This is useful if you have a long 'BLN file and the header count is off for a few objects. '1. Edit the SaveFile file path to where you want to save the edited BLN file. '2. Run the script and follow the prompts. Sub Main SaveFile = "c:\temp\test.bln" Dim SurferApp As Object Set SurferApp = CreateObject("Surfer.Application") SurferApp.Visible = True 'Specifies input data BLNFile$ = GetFilePath( , "bln",path1, "Select bln file") If BLNFile$ ="" Then End 'Opens BLN file Dim Wks As Object Set Wks = SurferApp.Documents.Open(FileName:=BLNFile$) 'Defines worksheet range as columns A and B Dim WksRange As Object Set WksRange = Wks.Columns(Col1:=1, Col2:=2) 'Define the header flag in Column B for the objects in the BLN file Flag= Val(InputBox$("Enter the flag value in Column B in the BLN file. It must be the same for each object in the BLN. Usually, this is a 0 or 1.", "Specify Flag Value", "1")) 'Sets BLN header RowToChange = 0 For row=1 To WksRange.RowCount 'If Grid.IsBlanked(row,col) = True Then Grid.SetNode(row,col) = 0 If Wks.Cells("B"+row).Value=Flag Then If RowToChange >0 Then Wks.Cells("A"+ RowToChange).Value = Row-RowToChange-1 End If RowToChange = row End If If Row = WksRange.RowCount Then Wks.Cells("A"+RowToChange).Value = Row-RowToChange End If Next row 'Saves to a new BLN file Wks.SaveAs(FileName:=SaveFile) End Sub