Name a Range based on Dates

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
 
B

Bob Phillips

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top