Help With Forms

D

Dave_2k5

I have two forms in an excel document, one has a textbox on, the othe
has a calendar control on it.

When I click a button on my excel sheet the first form opens, there i
a textbox with the text please enter date, and another button name
"Calender".

When you press "Calandar" it opens the calendar form. what I want t
happen is when I click on a date in the calender is for that value t
then appear in the inputbox on the first form.

I can get the calendar to put the date in a cell using the followin
code:

Private Sub Calendar1_Click()

Range("A4").Activate
ActiveCell = Calendar1.Value
ActiveCell.NumberFormat = "dd/mm/yy"

End Sub

But I need it to be in the text box on the first form

PLEASE HELP!!

Dav
 
T

Tom Ogilvy

Userform1.Textbox1.Value = format( Calendar1.Value,"mm/dd/yyyy")

Userform1 refers to the first form (substitute the correct name).
"Userform1" must still be loaded at the time you do this, so if you drop it
before showing the calendar, then do it with Hide rather than Unload. If it
is still showing, it should work OK.
 

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