View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Stephen Rasey[_2_] Stephen Rasey[_2_] is offline
external usenet poster
 
Posts: 41
Default Writing Macros in Excel

In the VBA macros, you must use
Application.worksheetfunction.Min(argument)

If you do this sort of thing a lot, you can do
Dim wsf as worksheetfunction
Set wsf as Application.worksheetfunction
......
Cells(i,7) = wsf.Min(range(cells(j,2),cells((K,2)))

I confess I have not seen this syntax before. Do you know that it works?
(Cells(j, 2)(k, 2)).
Do you mean Min (Cells(j, 2),cells(k, 2)). (just 2 cells compared)

Stephen M. Rasey
WiserWays, LLC
Houston, TX
http://excelsig.org


"Shannon" wrote in message
...
Am trying to write a Macro that looks at three fields
(cells) and gives me the Minimum, Maximum, and Average
into another specified field, i.e. Cells(i, 7).Value = Min
(Cells(j, 2)(k, 2)). Get error message that Min is an
undefined Sub or Function. How do I calculate the Min?