Vba error

Closed
fvba Posts 8 Registration date Sunday 19 July 2009 Status Member Last seen 3 September 2009 - 30 Aug 2009 à 22:05
fvba Posts 8 Registration date Sunday 19 July 2009 Status Member Last seen 3 September 2009 - 3 Sep 2009 à 01:39
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
Related:

1 response

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