Name a Range based on Dates

  • Thread starter Thread starter Soniya
  • Start date Start date
S

Soniya

Hello All,

I have dates starting from 01-03-2006 and till today

The dates keeps on adding but the same date is not repeated. Or say
even f it is repeated it is sorted according to date.

No how i can dynamically name the range based on month? for eg
01-03-2006 to 31-03-2006 named as RngMarch and 01-04-06 to 30-04-06 as
RngApr and so on..

Thanks
 
Dim iStart As Long
Dim iend As Long
Dim rng As Range

iStart =
ActiveSheet.Evaluate("=MIN(IF(MONTH(A1:A1000)=3,ROW(A1:A1000)))")
iend = ActiveSheet.Evaluate("=MAX(IF(MONTH(A1:A1000)=3,ROW(A1:A1000)))")
Set rng = Range("A" & iStart & ":A" & iend)
rng.Name = "rngMarch"


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
Back
Top