View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
GS[_6_] GS[_6_] is offline
external usenet poster
 
Posts: 1,182
Default Call subroutine based on combination of Option buttons (two groups)

Wow! Talk about doing things the hard way!! Wouldn't it be a lot
simpler/cleaner/easier to use a formula?

HowTo:
Create 2 local scope Defined Names; 1 for the months col, 1 for the formula
that calcs the average...

-Select A1 on "2016" and open the Define Name dialog
-in the namebox type 2016!ThisMonth
-in the RefersTo box type =$A1
-click the 'Add' button

-in the namebox type 2016!MonthAvg
-in the RefersTo box type =SUMIF(A:A,ThisMonth,C:C)/COUNTIF(A:A,ThisMonth)
-click the 'Add' button

Repeat this for each sheet.

-in colD enter the formula =MonthAvg once for each month you want to avg. (I
put it in D4 and D7 for your sample data, but anywhere in a month's range will
work!)

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion