View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
RocketDude[_2_] RocketDude[_2_] is offline
external usenet poster
 
Posts: 7
Default Help with Error in Function Definition

Hi,

I have a function in my module (see code below) that when I try and compile
the module gives me the following compile error:
"User-defined type not defined"

Function Code:
---------------------
Public Function GetLastRow(wrksheet As Sheet) As Long
' Use this function to find the last row (number) used
Dim rng As Range
Dim LastRow As Long

'Use a range on the sheet
Set rng = Sheets(wrksheet).Range("B5:B500")

' Find the last row
LastRow = Last(1, rng)
GetLastRow = LastRow

End Function
---------------------------

I cannot figure out what's wrong with the above function declaration. Does
anyone have a suggestion of what I'm doing wrong?

Thanks,

RocketDude