'WorksheetComparison.bas will compare values in a column to another cell value 'if the values match, then you can clear or delete the column data. '======================================== Sub Main Dim SurferApp As Object Set SurferApp = CreateObject("Surfer.Application") SurferApp.Visible = True 'Open the Worksheet Dim Wks As Object filename$ = GetFilePath(,"dat") If filename$ <> "" Then Set Wks = SurferApp.Documents.Open(filename$) End If 'Specify which cell to compare to and set it to variable. 'This example sets cell C2 to variable "Time" Dim Time As Variant Set Time = Wks.Cells("C2") 'Sets the WksRange variable to all rows in the worksheet (Columns A-C in this example) Dim WksRange As Object Set WksRange = Wks.Columns(Col1:=1, Col2:=3) 'Clears the data in selected column (C) if it is equal to Time For i=3 To Wks.UsedRange.LastRow If WksRange.Cells("C"+Format (i)) = Time Then WksRange.Cells("C"+Format (i)).Clear End If Next i 'Deletes the data in selected column (C) if it is equal to Time ' For i=3 To Wks.UsedRange.LastRow ' If WksRange.Cells("C"+Format (i)) = Time Then ' WksRange.Cells("C"+Format (i)).Delete(Direction:=wksDeleteUp) ' i=i-1 ' End If ' Next i 'Saves the data file with Time in name Wks.SaveAs(FileName:="C:\temp\"+Time+".txt") End Sub