开发者

Passing a Worksheet to a subroutine

开发者 https://www.devze.com 2022-12-21 17:44 出处:网络
I have the following code: Private Sub SortWorksheet(ByVal sheet As Worksheet) Dim sStartCol开发者_如何学运维umn

I have the following code:

Private Sub SortWorksheet(ByVal sheet As Worksheet)
    Dim sStartCol开发者_如何学运维umn
    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?


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

SortWorksheet DestSheet

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

0

精彩评论

暂无评论...
验证码 换一张
取 消