EssVKeepOnly

Description

Retains only the selected member(s) in the worksheet and removes unselected members.

Syntax

EssVKeepOnly(sheetname, range, selection)
ByVal sheetName As Variant
ByVal range As Variant
ByVal selection As Variant

Parameters

sheetName

Text name of worksheet to operate on. sheetName is of the form "[Book.xls]Sheet". If sheetName is Null or Empty, the active worksheet is used.

range

Range object which refers to the data to be used. The range must include the member names and data cells. If range is Null or Empty, the whole worksheet is used.

selection

Range object which refers to the member(s) that are kept. If selection is Null or Empty, the active cell is used.

Return Value

Returns 0 if successful. A negative number indicates a local failure (see VBA Return Values). A return value greater than zero indicates a failure on the server.

Example

Declare Function EssVKeepOnly Lib "ESSEXCLN.XLL" (ByVal sheetName As Variant, ByVal range As Variant, ByVal selection As Variant) As Long

Sub KOnly()
' Keep Only on one member name
X=EssVKeepOnly("[Book2.xls]Sheet1", RANGE("A1:G52"), RANGE("D2"))
If X = 0 Then
MsgBox("Keep Only successful.")
Else
MsgBox("Keep Only failed." + X)
End If

' Keep Only on two member names
X=EssVKeepOnly("[Book2.xls]Sheet1", RANGE("A1:G52"), RANGE("D2, A5"))
If X = 0 Then
MsgBox("Keep Only successful.")
Else
MsgBox("Keep Only failed." + X)
End If
End Sub