myVariable = Application.WorksheetFunction.Max(Range("a1:g200"))
--
Regards,
Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect
"Snowsride" wrote:
|I want to assign the value a formula to a variable. In a sheet named Data
I
| have range of cells a1:g200 that contain values. I want to assign the
| maximum value to myVariable.
|
| I've tried:
|
| myVariable = Max(Range("Data!a1:g200")).Value
|
| but I get an error 'Sub or Function not defined.
|
| Thanks for any help.