View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default Max WorksheetFunction

Hi
this works fine for me. what error did you get?
does the sheet 'sheet1' exist??

--
Regards
Frank Kabel
Frankfurt, Germany

solo wrote:
I have a sub that looks like the one below but it gives me an error
when I try to run it, it compiles fine and I cannot seem to know
whats wrong.

sub FindMax()

Dim VarMaxVal As Variant
VarMaxVal = 0
Dim myRange As Range

Set myRange = Worksheets("Sheet1").Range("T7:T64")
VarMaxVal= Application.WorksheetFunction.Max(myRange)

End Sub