|
-
August 22nd, 2001, 02:14 PM
#1
visual basic in excel
Here is an odd occurance. I am creating a time sheet in excel and using some of the visual basic commands in the background.
Here is the breakdown:
Enter the date and press return.
Next 2 weeks worth of dates appear on the excel form.
As soon as i press enter for the date, the sytem date is changed to match the date that i just entered. (System date is the date on my taskbar).
Any tips on avoiding this problem?
Thank You in advance.
Here is my code:
Private Sub cmdEnter_Click()
Date = txtDate.Value
lblSunDate1.Caption = Date
lblMonDate1.Caption = Date + 1
lblTueDate1.Caption = Date + 2
lblWedDate1.Caption = Date + 3
lblThuDate1.Caption = Date + 4
lblFriDate1.Caption = Date + 5
lblSatDate1.Caption = Date + 6
lblSunDate2.Caption = Date + 7
lblMonDate2.Caption = Date + 8
lblTueDate2.Caption = Date + 9
lblWedDate2.Caption = Date + 10
lblThuDate2.Caption = Date + 11
lblFriDate2.Caption = Date + 12
lblSatDate2.Caption = Date + 13
End Sub
-
August 22nd, 2001, 02:38 PM
#2
Re: visual basic in excel
Switch the line
Date = txtDate.Value
to this...
txtDate.Value = Date
-
August 22nd, 2001, 03:09 PM
#3
Re: visual basic in excel
Also change
lblMonDate1.Caption = Date + 1
to
lblMonDate1.Caption = DateAdd("d", 1, Date)' add 1 day
lblTueDate1.Caption = DateAdd("d", 2, Date)' add 2 days
etc
Iouri Boutchkine
[email protected]
-
August 22nd, 2001, 04:35 PM
#4
Re: visual basic in excel
Hi,
Date, is a vb keyword that trigger the system date or get the system date.
use another variable name
instead of
Date = txtDate.Value
use
Date1 = txtDate.Value
Thanks
Hisham
Thank You, Hisham
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|