Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default date update in VBA

I have two date boxes on a user form, txtDate and txt Due. Both have
check boxes that are default "false." I would like the txtDue to become
"true" when I check txtDate and automatically assume the same date as
txtDate. How do I accomplish this?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 510
Default date update in VBA

Hi,

By coding your check box1 ...
Private Sub CheckBox1_Click()
CheckBox2.Enabled = True
CheckBox2.Value = CheckBox1.Value
End Sub
be sure to adjust with your names ...

HTH
Carim

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default date update in VBA


Why not set the value property of the second box to try as part of the
change method of the first.


--
mrice


------------------------------------------------------------------------
mrice's Profile: http://www.excelforum.com/member.php...o&userid=10931
View this thread: http://www.excelforum.com/showthread...hreadid=532743

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default date update in VBA

Carim's method works, but it only enables txtDue when I click
txtDate. I actually want txtDue to stay disabled until I click it, I
just want it's value to change to the value in txtDate when I enable
it. (I dont always use a Due Date, but if I do it is generally the next
day or two, so it is easier to start from the Date.)(If that is clearer
than mud.)

I don't know how to follow mrice's advice. I tried to set the
value in txtDue to "txtDate" and get an error message. (???)

I appreciate your help.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default date update in VBA

if txtDate and txtDue are checkboxes and txtDue has the enabled property set
to false when the userform is shown. then you want to click one the area of
the disabled checkbox and have it come to life and take on the value of the
checkbox txtDate, then you can use this:

Private Sub UserForm_MouseDown(ByVal Button _
As Integer, ByVal Shift As Integer, _
ByVal X As Single, ByVal Y As Single)
With txtDue
If Y = .Top And Y <= .Top + .Height Then
If X = .Left And X <= .Left + .Width Then
.Enabled = True
.Value = txtDate.Value
End If
Else
End If
End With

End Sub

--
Regards,
Tom Ogilvy



"L Scholes" wrote:

Carim's method works, but it only enables txtDue when I click
txtDate. I actually want txtDue to stay disabled until I click it, I
just want it's value to change to the value in txtDate when I enable
it. (I dont always use a Due Date, but if I do it is generally the next
day or two, so it is easier to start from the Date.)(If that is clearer
than mud.)

I don't know how to follow mrice's advice. I tried to set the
value in txtDue to "txtDate" and get an error message. (???)

I appreciate your help.




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default date update in VBA

I want both to be disabled when the userform is initally activated in
case I dont need the dates. I will have to enter a date, but not always
a due date, so I want them to activate independantly, but when I
activate txtDue, I want it to assume the same date as txtDate instead
of todays date. Not critical, but because the due date is always close
to the date it will be faster to start from the date instead of today.
I would try to use your method, but I'm not even sure where in my
current code to place it; I am trying now, after posting this.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default date update in VBA


This I think is what you're wanting. If not let me know.

Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then
CheckBox2.Value = True
textbox2.Value = textbox1.Value
Else:
CheckBox2.Value = False
textbox2.Value = Date
End If
End Sub


Adjust the names to your's and put the code under the checkbox tha
you're wanting to activate

--
dok11
-----------------------------------------------------------------------
dok112's Profile: http://www.excelforum.com/member.php...fo&userid=1058
View this thread: http://www.excelforum.com/showthread.php?threadid=53274

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Clarification - how to automatically update cells with a date and date range Bekki Excel Discussion (Misc queries) 1 August 31st 10 03:18 AM
Automatically update a cell with a date based on anther cells date GPR GUY Excel Discussion (Misc queries) 2 November 3rd 08 03:57 PM
input a date or update it based on date in another cell Doug P New Users to Excel 1 July 18th 07 11:25 PM
How to update a cell if a specific date is included in a date rang mgavidia Setting up and Configuration of Excel 2 October 8th 05 12:53 AM
Date update on data update Chris Thompson Excel Programming 3 August 22nd 03 06:40 PM


All times are GMT +1. The time now is 12:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"