Count Down Days - Solved

Beyond Me

Board Regular
Joined
Dec 29, 2004
Messages
62
I've setup a user form but am having one problem. I want to add a label so that it counts down the number of days.

Example today is the 26th August and I would like the label to show the number of days between today and the 1st September. When the file is opened tomorrow it will be 1 day less and so on.

This is what I've done so far but it does not show the result as days

Code:
Label1.Caption = #1/9/2006# - Now()

Can anyone assist?
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Not code, but try this in a cell: =IF(ISERROR(DATEDIF(TODAY(),"9/1/2006","d")),"Past Due",DATEDIF(TODAY(),"9/1/2006","d")) The words "Past Due" may be altered to suit your needs. /s/ Larry
 
Upvote 0
Try

Code:
UserForm1.Label1.Caption = #9/1/2006# - Date

Note - I had to use the American m/d/yyyy to get this to work.

Edit: Doh - too late as usual!
 
Upvote 0
Hi there

this is a bit long winded but it will allow you to enter UK date formats

Code:
Dim date1 As Date, futdate As Date
date1 = Format(Now, "[$809]dd mmmm yyyy")
futdate = Format("01-09-2006", "[$809]dd mmmm yyyy")
Me.Label1.Caption = futdate - date1 & " days remaining until " & futdate

If getting the date from a spreadsheet cell just change the first part of the futdate Format, where I've got the date as 1st sept to the address of the cell containing the date.

Regards
Colin
 
Upvote 0

Forum statistics

Threads
1,203,468
Messages
6,055,597
Members
444,800
Latest member
KarenTheManager

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top