Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / February 2007

Tip: Looking for answers? Try searching our database.

subtracting serial dates

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ll - 15 Feb 2007 17:05 GMT
Hi,
I have calendar objects populating two text boxes in my Excel vba
form, with a third box to show the difference of the first two (I
subtract box 1 from box 2).
I am getting a mismatch error, however, and I was wondering if a
change in formatting would correct this?  Thanks for any help you can
provide.
Kind Regards,
Louis
===
Here is my code for the form:

Private Sub TextBox1_Change()
End Sub

Private Sub TextBox2_Change()
Dim fillamt As Date
fillamt = UserForm1.TextBox2 - UserForm1.TextBox1
TextBox3 = fillamt
End Sub

Private Sub TextBox3_Change()
End Sub

Private Sub UserForm_Click()
End Sub
ll - 15 Feb 2007 17:48 GMT
I need to add that I get the error when I begin entering a date value
into box 2 (non-date, numerical values work fine).
Thanks

> Hi,
> I have calendar objects populating two text boxes in my Excel vba
[quoted text clipped - 22 lines]
> Private Sub UserForm_Click()
> End Sub
merjet - 15 Feb 2007 18:55 GMT
Private Sub TextBox2_Change()
   Dim dt1 As Date
   Dim dt2 As Date
   dt1 = TextBox1
   dt2 = TextBox2
   TextBox3 = dt2 - dt1
End Sub

Hth,
Merjet
Dave Peterson - 15 Feb 2007 20:39 GMT
Private Sub TextBox2_Change()
 Dim fillamt As Date
 fillamt = Cdate(UserForm1.TextBox2) - cdate(UserForm1.TextBox1)
 TextBox3 = format(fillamt, "mm/dd/yyyy")
End Sub

> Hi,
> I have calendar objects populating two text boxes in my Excel vba
[quoted text clipped - 22 lines]
> Private Sub UserForm_Click()
> End Sub

Signature

Dave Peterson

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.