How can i set the following variant to be a Tuesday on an Excel calendar

  • Thread starter Thread starter Corey ....
  • Start date Start date
C

Corey ....

Dim DOW As Variant
UserForm2 is a Form Calendar
If UserForm2.ActiveControl <> Day(DOW) Then MsgBox "Not a Tuesday"
Ctm....
 
Ok, got it to work (sort of) by placing a textbox(TextBox79) on the
userform(Userform1) where the date is placed and formatting it to "dddd".

Problem is that the Calendar1 seem to revert to the US "mm dd yy" instead of
AU "dd mm yy".
If the date selected is >12 then the Calendar seems to recognise the Tuesday
OK.
But if the date selected is <12 then even though the day selected was a
Tuesday, the Textbox created shows a Monday or Thursday instead.
The code i have now is:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
UserForm1.TextBox79.Value = Calendar1.Value
UserForm1.TextBox79.Value = Format(UserForm1.TextBox79.Value, "dddd")
If UserForm1.TextBox79.Value <> "Tuesday" Then MsgBox "You did not select a
Tuesday as the Day-Of-Week !!!", vbInformation, "...."
If UserForm1.TextBox79.Value = "Tuesday" Then
' Code to do stuff here
Unload Me
End If
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Is there a way to rectify this?

Corey....
 
I'm confused. Three days ago you posted a request asking how to, in effect,
force a user to only be able to select a Tuesday from your Calendar Control
and I provided you with code on how to do that. Wouldn't implement the code
I posted alleviate you from everything you seem to now be going through? Was
something wrong with the code I posted back then?

Rick
 
Interesting out come for me.
Found that no matter what format i tried with the textbox, i could not
revert it from "mm dd yyy" to "dd mm yyy",
So i tried replacing the textbox with a label, and found the label
instantly displayed the date in a "dd mm yyy" format.

The dishes are now doen with this topic.

Now where is that next problem going to come from ....
 
Ahh yes.
I did not see your reply back then.

Thank you for the reply, i have now however(long winded) solved the problem.
Sorry i did not see your post earlier.
Corey....
 

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

Back
Top