ho do i insert calendar into xls worksheet

D

Drahos

Hi Paul,
I need to use in my Excel Form a calender as described. I have done what
was recommeded on the webside you are reffering to. While choosing a cell
from the range where should be the calendar I receive the Runtime error "424"
- object required and the Debug shows this line:
Calendar1.Left = Target.Left + Target.Width - Calendar1.Width

If choosing a cell outside of the range I receive the same runtime error and
the Debug shows this line:

ElseIf Calendar1.Visible Then Calendar1.Visible = False

I use the Excel 2003.

Please, can you advice me what the problem is.
Thanks a lot.
 
R

Ron de Bruin

Hi Drahos

Maybe the Calendar you have add to the worksheet is not named
Calendar1

Check out the name
 
D

Drahos

Hi Ron,
you are right. Thanks a lot. Now one more question. I need to have in my
form severel cells containing Calendar. The problem is these fields are not
in a continuous range but they are on very different places. How can I do
this. Now I am not sure but there should be about 8 cells containing calendar.

Regards
Drahos.
 
R

Ron de Bruin

Hi Drahos

Change the Range

If Not Application.Intersect(Range("A1:A20,C1,C5,D20"), Target) Is Nothing Then
 
D

Drahos

Wow :eek:)
Ron, thank you to much.
Drahos.

Ron de Bruin said:
Hi Drahos

Change the Range

If Not Application.Intersect(Range("A1:A20,C1,C5,D20"), Target) Is Nothing Then
 
D

Drahos

Good morning Ron,

now, thanks to you calendar works perfectly. I would like to ask for your
help again. I hope last time concerning this issue.

I have a problem with a change of size of the calendar. If I change the
size of the calendar in a new empty sheet it works without any problem. But
if I do it in my Form after exiting the design mode the calendar is displaied
2x. One is in a requested size and the other is much smaller. The smaler one
is active. The calendar in requested size is behind the smaller one and is
inactive.
Do you have an idea what is wrong?

Thanks again in advance.
Drahos.
 
D

Drahos

Hi Ron,

I have sent it to your emai address mentioned on your webside
(e-mail address removed)

Thanks a lot.

Drahos
 
R

Ron de Bruin

OK

My provider have server problems the last weeks so it is possible
that I can't read your mail today (sometimes a few hours)
 
R

Ron de Bruin

Hi Drahos

Yes I see the same problem.

Workaround is to comment the event code in the sheet module before you change the size
If you are ready uncomment the code
 
D

Drahos

Hi Ron,

thanks for your kind help. The problem is that I have no idea what I am
supposed to do in the sheet module code. What "workaround" is to be
commented and in which event code. I am not an expert in Excel :eek:(

Please, can you explain in more details or wright an example.

Best Regards
Drahos.
 
D

Drahos

Dear Ron,
I have tried to experiment a little and I have found and I have done what
is necessary. Your advice and great support is amazing as usually.
Once again thanks a lot.
Have a nice time.

Regards Drahos.
 
D

Drahos

Hi Ron,

sorry I am to you. When I do what you have adviced at home it works. But if
I do it in the office I still have 2 Pop Up Calenders. At home I have Czech
XP Professional and Czech Office 2003. In the office I have Englich Version
of those two applications. I have not take the file from home to run it in
the office. But the home file has been originaly created in the office.

Do you have any idea?
Thanks a lot for your help.
Drahos.
 
R

Ron de Bruin

Hi Drahos

I have test it in a English version

Try it again

Note: if you are in the VBA
View>Toolbars>Edit

On the Edit toolbar you find the buttons to comment and uncomment the
selected code
 
R

Ron de Bruin

I think I do this

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Not Application.Intersect(Range("A1:A20"), Target) Is Nothing Then
Calendar1.Left = Target.Left + Target.Width - Calendar1.Width
If Target.Row < 4 Then
Calendar1.Top = Rows("4").Top
Else
Calendar1.Top = Target.Top + Target.Height
End If
Calendar1.Visible = True
' select Today's date in the Calendar
Calendar1.Value = Date
ElseIf Calendar1.Visible Then Calendar1.Visible = False
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top