Find specific days in 75 day range

aldeb

Registered User.
Local time
Yesterday, 21:01
Joined
Dec 23, 2004
Messages
318
I would like to select a date on a calendar and go back 75 days from the date selected and show every Tuesday, Thursday and Saturday in the 75 day range. I would like to see the actual date of each Tue. Thur. & Sat. Please advise and thanks. I am using Excel 2003.
 
I am using Calendar Control 11 inserted as object in the worksheet. I want the results (dates) displayed in cells on the worksheet. Thanks again.
 
You could write code to loop through the date range using weekday to identify the days you require.
There might be a smart way to do it from just knowing the first day in the range.


Brian
 
I am so new to this I have no idea what you are speaking of. Basically I want to select a date on the calendar object and go back 75 days only see Tue. Thur. & Sat. dates in rows on a worksheet.
 
I am on 2013 which does not have a date picker and as I have never used one cannot speak from experience, but I assume that you get a date into a cell in which case it is easy to calculate this minus 75 giving you the end and start dates for your search, my code has them hard code as stated. I have put the results in cols.

It should help you get going if you haven't already.

Brian

Code:
Sub mytest()
'B3 contains start of range and B4 the last date
Dim stdate As Date
Dim rtue As Long
Dim rthu As Long
Dim rsat As Long
sdate = Range("B3")
rtue = 2
rthu = 2
rsat = 2
Do
      Select Case Weekday(sdate)
        Case vbTuesday
            Cells(rtue, "D") = sdate
            rtue = rtue + 1
        Case vbThursday
            Cells(rthu, "E") = sdate
            rthu = rthu + 1
        Case vbSaturday
            Cells(rsat, "f") = sdate
            rsat = rsat + 1
    End Select
    sdate = sdate + 1
Loop Until sdate > Range("B4")

End Sub
 

Users who are viewing this thread

Back
Top Bottom