wksDelete Values

Enumeration

Value

Description

wksDeleteUp

0

shift cells up

wksDeleteLeft

1

shift cells left

wksDeleteRows

2

delete entire row

wksDeleteColumns

3

delete entire column

Example to Delete Rows with values < X

This example deletes all rows of data that have values in column C < 10000.

Sub Main
Dim SurferApp As Object
Set SurferApp = CreateObject("Surfer.Application")
SurferApp.Visible = True

Dim Wks As Object
filename$ = GetFilePath(,"dat")
If filename$ <> "" Then
Set Wks = SurferApp.Documents.Open(filename$)
End If

'Sets the WksRange variable to all rows in Column C
Dim WksRange As Object
Set WksRange = Wks.Columns(Col1:=3)

'Deletes the entire row if data in any cell in column C is greater than 10000
For i=2 To Wks.UsedRange.LastRow
If WksRange.Cells(i,1) > 10000 Then
WksRange.Cells(i,1).Delete(Direction:=wksDeleteRows)
i=i-1
End If
Next i
End Sub