tags:

views:

105

answers:

1

I have the following code:

Private Sub SortWorksheet(ByVal sheet As Worksheet)
    Dim sStartColumn
    Dim iTopRow
    Dim sEndColumn
    Dim iBottomRow
    Dim Rng As Range
    Dim sRange1 As String
    .
    .
    .

and I am calling the function like so:

SortWorksheet (DestSheet)

I am getting a runtime error on the above line saying "Object doesn't support this property or method"

DestSheet is a worksheet variable.

Why is this code not working?

+1  A: 

Disregard, apparently in VBA the subroutine has be called like this

SortWorksheet DestSheet

Hey, I'm a C/C++/C# guy! :)

Bobby
Hey Bobby, if you prefer to use the parentheses when making a method call -- which I do, and given your C/C# background, I'm sure that you do to -- you can make use of VBA's `Call` keyword, as in `Call SortWorksheet(DestSheet)`
Mike Rosenblum