Userform Calendar not visible

Alminc

New Member
Joined
Mar 30, 2018
Messages
20
Hi,

I have a userform calendar with following code:
Code:
Private Sub cmdClose_Click()
Unload Me
End Sub

Private Sub MonthView1_DateClick(ByVal DateClicked As Date)

On Error Resume Next
   ActiveCell.Value = DateClicked
   Unload Me
   
End Sub

Private Sub UserForm_Initialize()

With Me
    .StartUpPosition = 0
    .Top = ActiveCell.Top
    .Left = ActiveCell.Offset(, -1.8).Left
End With


If IsDate(ActiveCell.Value) Then
      Me.MonthView1.Value = ActiveCell.Value
   End If
End Sub

And this code is in the worksheet:
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Not Intersect(Target, Me.Range("E10:E1048576,F10:F1048576,O10:O1048576,P10:P1048576")) Is Nothing Then
        frmKalender.Show
    End If
End Sub


Now I have three problems:

1) When I select a cell far down, say in a row 100, the calendar pops up but it is not visible on the screen.
Positioning should be changed somehow so it's allways visible no matter how far down the selected cell is.

2) When I select a whole row, I get some error message:

"Run-time error "1004":
Application-defined or object-defined error "

which points to this line of code:
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Not Intersect(Target, Me.Range("E10:E1048576,F10:F1048576,O10:O1048576,P10:P1048576")) Is Nothing Then
        [COLOR=#ff0000]frmKalender.Show[/COLOR]
    End If
End Sub

3) When I select the whole column, say column E, the calendar pops up and when I pick a date, the date shows up in a cell that is in the first row, even if my specified range starts from 10th row for that column.

I need help to correct these three issues.

Almin
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Not sure quite what you're trying to do.
Why not just have it show in the middle of the screen?
 
Upvote 0
How to do that?

I was trying to get it ti always appear near the selected cell.
 
Last edited:
Upvote 0
Just remove this from the initialize event
Code:
With Me
    .StartUpPosition = 0
    .Top = ActiveCell.Top
    .Left = ActiveCell.Offset(, -1.8).Left
End With
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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