Vba error

Closed
fvba Posts 8 Registration date Sunday July 19, 2009 Status Member Last seen September 3, 2009 - Aug 30, 2009 at 10:05 PM
fvba Posts 8 Registration date Sunday July 19, 2009 Status Member Last seen September 3, 2009 - Sep 3, 2009 at 01:39 AM
Hello,

'---Function: getWSUsedRowNum---------------------------------
'---Retrieves number of used rows for a specified sheet-------
'---Parameters/Accepts:---------------------------------------
'---(1)ws: The worksheet to check-----------------------------
'---Returns: (1)Integer---------------------------------------

Public Function getWSUsedRowNum(ws As Worksheet) As Integer
With ws.UsedRange
getWSUsedRowNum = .Rows.Count
End With
End Function

Hi everyone

I have a problem. The above chunk of codes
at this line >> getWSUsedRowNum = .Rows.Count <<
when I run my program it stops at this line and says
"Run-time error '91':
Object variable or With block variable not set"

can anybody kind-hearted please tell me is there anything wrong with here?
Please and thank you in advance

1 reply

fvba Posts 8 Registration date Sunday July 19, 2009 Status Member Last seen September 3, 2009
Sep 3, 2009 at 01:39 AM
Okay.
0