ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Calendar range and date intersect (https://www.excelbanter.com/excel-programming/371538-calendar-range-date-intersect.html)

[email protected]

Calendar range and date intersect
 
How do I fill with a specific value the returned active cell from the
intersect of a calendar dates range in Row 1 (Col B thru ...) and any
date from a Target dates list in Col. A ?
Thank you for help.
Celeste


Tom Ogilvy

Calendar range and date intersect
 
Your question is not very clear, but perhaps something here.

Dim res as Variant, res2 as Variant
Dim dt as Date
dt = "some date"
res = Application.Match(clng(date),rows(1),0)
res2 = Application.Match(dt,Columns(1),0)
if not iserror(res) and not iserror(res2) then
cells(res2,res).Value = "Intersect"
else
msgbox "At least one date not found"
End if

--
Regards,
Tom Ogilvy




wrote in message
oups.com...
How do I fill with a specific value the returned active cell from the
intersect of a calendar dates range in Row 1 (Col B thru ...) and any
date from a Target dates list in Col. A ?
Thank you for help.
Celeste




Tom Ogilvy

Calendar range and date intersect
 
Sub ABC()
Dim cell as Range, res as variant
for each cell in Range(Range("A2"),Range("A2").End(xldown))
res = application.Match(clng(cell),rows(1),0)
if not iserror(res) then
cells(cell.row,res).Value = cell.offset(0,1).Value
end if
Next
End Sub

this assumes the entries like 8/14 are actually stored as dates like
8/14/2006 in both row and column and formatted to show as m/dd

--
Regards,
Tom Ogilvy


"Tom Ogilvy" wrote in message
...
Your question is not very clear, but perhaps something here.

Dim res as Variant, res2 as Variant
Dim dt as Date
dt = "some date"
res = Application.Match(clng(date),rows(1),0)
res2 = Application.Match(dt,Columns(1),0)
if not iserror(res) and not iserror(res2) then
cells(res2,res).Value = "Intersect"
else
msgbox "At least one date not found"
End if

--
Regards,
Tom Ogilvy




wrote in message
oups.com...
How do I fill with a specific value the returned active cell from the
intersect of a calendar dates range in Row 1 (Col B thru ...) and any
date from a Target dates list in Col. A ?
Thank you for help.
Celeste







All times are GMT +1. The time now is 06:16 AM.

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