Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
ll ll is offline
external usenet poster
 
Posts: 67
Default subtracting serial dates

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
ll ll is offline
external usenet poster
 
Posts: 67
Default subtracting serial dates

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


On Feb 15, 11:05 am, "ll" wrote:
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default subtracting serial dates

Private Sub TextBox2_Change()
Dim dt1 As Date
Dim dt2 As Date
dt1 = TextBox1
dt2 = TextBox2
TextBox3 = dt2 - dt1
End Sub

Hth,
Merjet


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default subtracting serial dates

Private Sub TextBox2_Change()
Dim fillamt As Date
fillamt = Cdate(UserForm1.TextBox2) - cdate(UserForm1.TextBox1)
TextBox3 = format(fillamt, "mm/dd/yyyy")
End Sub


ll wrote:

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


--

Dave Peterson
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
Dates as Serial Values Lucy N Excel Discussion (Misc queries) 6 July 6th 06 01:53 PM
Serial Dates Airfive Excel Discussion (Misc queries) 4 January 7th 06 04:56 PM
Averaging a Value between Two Serial Dates ChrisM New Users to Excel 1 November 16th 05 03:09 AM
Averaging Value between Two Serial Dates ChrisM Links and Linking in Excel 1 November 16th 05 12:25 AM
Averaging a Value Between Two Serial Dates ChrisM Excel Worksheet Functions 1 November 15th 05 08:45 PM


All times are GMT +1. The time now is 06:19 AM.

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

About Us

"It's about Microsoft Excel"