L
Legacy 98055
Guest
Hi.
This workbook brings up a calendar whenever the user selects a single cell in a specific range. It works fine as is. However, when the workbook is shared the code fails. The errors are occuring whenever the Left or Top properties of the control are assigned new values.(These values will vary depending on the user's range selection.)
Any ideas?
Thanks,
Tom<pre>
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim r As Long, c As Integer
If CheckBox1 Then Exit Sub
If Selection.Rows.Count<> 1 Then
Calendar1.Visible = False
Exit Sub
End If
r = Target.Row
c = Target.Column
If c = 3 And r > 6 Then
Calendar1.Value = Now
Calendar1.Refresh
Calendar1.Left = Cells(r, c + 1).Left + 5
If Cells(r, c).Top - (Calendar1.Height / 2) > 79 Then
Calendar1.Top = Cells(r, c).Top - (Calendar1.Height / 2)
Else
Calendar1.Top = 79.5
End If
Calendar1.Visible = True
End If
End Sub</pre>
This message was edited by TsTom on 2002-08-27 13:11
This workbook brings up a calendar whenever the user selects a single cell in a specific range. It works fine as is. However, when the workbook is shared the code fails. The errors are occuring whenever the Left or Top properties of the control are assigned new values.(These values will vary depending on the user's range selection.)
Any ideas?
Thanks,
Tom<pre>
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim r As Long, c As Integer
If CheckBox1 Then Exit Sub
If Selection.Rows.Count<> 1 Then
Calendar1.Visible = False
Exit Sub
End If
r = Target.Row
c = Target.Column
If c = 3 And r > 6 Then
Calendar1.Value = Now
Calendar1.Refresh
Calendar1.Left = Cells(r, c + 1).Left + 5
If Cells(r, c).Top - (Calendar1.Height / 2) > 79 Then
Calendar1.Top = Cells(r, c).Top - (Calendar1.Height / 2)
Else
Calendar1.Top = 79.5
End If
Calendar1.Visible = True
End If
End Sub</pre>
This message was edited by TsTom on 2002-08-27 13:11