Hi folks,
I am in the process of creating a report. I am using what I call a "Date Range Selector" that utilizes a spin up and down button, as well as a form selection for monthly and daily. Essentially you can open the report and select if you want to view the data by month, or by day. I think I have all of cell references set up correctly starting in O2. Now when I have selected the "Daily" option I can cycle through up or down just fine and excel pulls back whatever that date is for me. Now when I select Monthly, the spinner doesn't work (I believe because the code is set to look for weekly data) Ideally I would want the spinner to continue working how it does for the daily option, but then look at cell p2 & p3 to pull back the month and then start cycling through up or down by month.
I know this sounds a little confusing so attached you will find a copy of the work book, I will also include a copy of the code below.
The spinner works by looking at the listed days. You can find all of this info starting in cell o1 and over. I would like to keep everything how it is, but find a way to use the spinner to move through months. Basically when I click the spin up button cell P1 will move to the first day of the next month, and cell p2 will move to the last day of the next month (and the opposite when pushing the spin down button).
Thanks!
![]()
Private Sub SpinButton1_SpinDown() On Error Resume Next If Range("o1") = 1 Then Range("o2").Value = Range("o2").Value - 1 Else Range("o2").Value = Range("o2").Value - 6 End If End Sub Private Sub SpinButton1_SpinUp() On Error Resume Next If Range("o1") = 1 Then Range("o2").Value = Range("o2").Value + 1 Else Range("o2").Value = Range("o2").Value + 6 End If End Sub
Bookmarks