Display Calendar at Top of Cell Grid

fetchboi88

New Member
Joined
Mar 9, 2009
Messages
4
I have a command button in cell A1, with the first row of the sheet frozen. When you click the command button, I'd like a calendar to be displayed under it. My problem is, however, that when the calendar is shown, it's only shown on cell A2, so if the user has scrolled down to row 100, you cannot see the calendar.

Is there a way to get the calendar to be shown under the first row no matter where the user has scrolled to?

Here's the non-working code i have now:

Code:
Private Sub cmdGoTo_Click()
    If Calendar1.Visible = False Then
        'i think the first row that is visible needs to be determined before this
        Calendar1.Top = Range("A1").Rows.Top + Range("A1").Rows.Height
        Calendar1.Left = cmdGoTo.Left + cmdGoTo.Width
        Calendar1.Height = 179.25
        Calendar1.Width = 274.5
            
        Calendar1.Visible = True
    Else
        Calendar1.Visible = False
    End If
End Sub
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
This might do it:

Code:
Private Sub cmdGoTo_Click()
    Dim topRow As Long
    If Calendar1.Visible = False Then
        topRow = ActiveWindow.VisibleRange.Row
        Calendar1.Top = Rows(topRow).Top + Rows(topRow).Height
        Calendar1.Left = cmdGoTo.Left + cmdGoTo.Width
        Calendar1.Height = 179.25
        Calendar1.Width = 274.5
            
        Calendar1.Visible = True
    Else
        Calendar1.Visible = False
    End If
End Sub
 
Upvote 0
ahhhh VisibleRange - i was looking ffor something like that.

Thank you - i'll give it a shot at work tomorrow.
 
Upvote 0

Forum statistics

Threads
1,214,943
Messages
6,122,376
Members
449,080
Latest member
Armadillos

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top