0

A came across this very useful custom made calendar. One of the comments was : "Great! Useful Tool!!!"

I modified to save the picked date in a date variable, so I wouldn't have to reinterpret the date from text when I used it. In module, added: Private dPickedDate as Date. In each day command button changed to:

dPickedDate = DateSerial(
    Val(Format(CommandButton45.Caption, "YYYY")), _
    Val(Format(CommandButton45.Caption, "MM")), _
    CommandButton1.Caption) 
TextBox1.Text = Format(dPickedDate, "DD-MMM-YYYY")

My Question:

I'm not sure where/how to include the "Private dPickedDate as Date" Despite various attempts I can't get it to work...

Community
  • 1
  • 1
  • 1
    maybe you can better explain what you are trying to achieve. That quoted comment is unclear –  May 29 '14 at 07:02
  • I want to run my code, open the calender [userform] for the user to make his selection and then use the selection as variable in my code by allocating it to various other cells. – user3686449 May 29 '14 at 10:07
  • `Range("A1") = TextBox1.Value` doesn't do? –  May 29 '14 at 10:16

1 Answers1

0

Unfortunately I am not able to download the userform right now to check the code. But as I understand the comment, you should write

Private dPickedDate as Date

at the top of the UserForm1 module outside of any function.

Yoh
  • 678
  • 1
  • 10
  • 18