ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Name a Range based on Dates (https://www.excelbanter.com/excel-programming/369527-name-range-based-dates.html)

Soniya[_4_]

Name a Range based on Dates
 
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


Bob Phillips

Name a Range based on Dates
 
Dim iStart As Long
Dim iend As Long
Dim rng As Range

iStart =
ActiveSheet.Evaluate("=MIN(IF(MONTH(A1:A1000)=3,RO W(A1:A1000)))")
iend = ActiveSheet.Evaluate("=MAX(IF(MONTH(A1:A1000)=3,RO W(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)

"Soniya" wrote in message
oups.com...
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





All times are GMT +1. The time now is 12:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com