weiser386
New Member
- Joined
- Sep 2, 2015
- Messages
- 10
Good Afternoon,
I would imagine this is a really easy question for most of you however for me it is not.
So here is my issue, I have a worksheet that has a years worth of production data that is nicely lined out with the dates included.
I have two buttons at the top of the page, one button "Current Month" reduces the report down to just show the current months worth of data and the next button "View Year" UN-hides all the cells and shows the full years worth, currently when you press the "view year" button it works correctly but it reverts you back to the beginning of the worksheet at January's data...So what I need is for the "view year" button to UN-hides all the cells as normal and use the current month to find today() date and make that the return point of the worksheet instead of reverting it back to Jan all the time. Essentially it should work like a hyperlink in that a hyperlink finds the cell you select and centers it on your screen.
Here is my code for "Current Month" button:
Here is my code for "View Year" button:
Thanks in advance for your help, you guys are awesome!
I would imagine this is a really easy question for most of you however for me it is not.

So here is my issue, I have a worksheet that has a years worth of production data that is nicely lined out with the dates included.
I have two buttons at the top of the page, one button "Current Month" reduces the report down to just show the current months worth of data and the next button "View Year" UN-hides all the cells and shows the full years worth, currently when you press the "view year" button it works correctly but it reverts you back to the beginning of the worksheet at January's data...So what I need is for the "view year" button to UN-hides all the cells as normal and use the current month to find today() date and make that the return point of the worksheet instead of reverting it back to Jan all the time. Essentially it should work like a hyperlink in that a hyperlink finds the cell you select and centers it on your screen.
Here is my code for "Current Month" button:
Code:
Sub Breakaway_Button2_Click()
' hides all rows not from current month
Dim cell As Range
Application.ScreenUpdating = False
Rows.EntireRow.Hidden = False
For Each cell In Range("b4:b381")
If Month(cell.Value) <> (Month(Date)) Then
cell.EntireRow.Hidden = True
End If
Next
Application.ScreenUpdating = True
Here is my code for "View Year" button:
Code:
Sub Button2_Click()
Rows.EntireRow.Hidden = False
End Sub
Thanks in advance for your help, you guys are awesome!