Hi,
I have a userform calendar with following code:
And this code is in the worksheet:
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:
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
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