ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   dispay dates return in cell (https://www.excelbanter.com/excel-programming/424836-dispay-dates-return-cell.html)

tracktraining

dispay dates return in cell
 
Hi Everyone,

I want to display the dates return in the cell O1. But the following code
writes "sdate1 to sdate2" in the cell instead of something like 2/19/2009 to
2/20/2009. Can anyone help?


Dim sdate1 as Date, sdate2 as Date

sdate1 = Me.StartDate
sdate2 = Me.EndDate

Range("O1").FormulaR1C1 = "sdate1 to sdate2"

Thanks,
Tracktraining
--
Learning

Mike

dispay dates return in cell
 
Try this
Range("O1").FormulaR1C1 = sdate1 & " to " & sdate


"tracktraining" wrote:

Hi Everyone,

I want to display the dates return in the cell O1. But the following code
writes "sdate1 to sdate2" in the cell instead of something like 2/19/2009 to
2/20/2009. Can anyone help?


Dim sdate1 as Date, sdate2 as Date

sdate1 = Me.StartDate
sdate2 = Me.EndDate

Range("O1").FormulaR1C1 = "sdate1 to sdate2"

Thanks,
Tracktraining
--
Learning


Mike H

dispay dates return in cell
 
Hi,

I've got no idea where you are populating the variables sdate1 etc but try
this

Dim sdate1 As Date, sdate2 As Date

sdate1 = Me.StartDate
sdate2 = Me.EndDate
Range("O1").Value = sdate1 & " to " & sdate2


Mike

"tracktraining" wrote:

Hi Everyone,

I want to display the dates return in the cell O1. But the following code
writes "sdate1 to sdate2" in the cell instead of something like 2/19/2009 to
2/20/2009. Can anyone help?


Dim sdate1 as Date, sdate2 as Date

sdate1 = Me.StartDate
sdate2 = Me.EndDate

Range("O1").FormulaR1C1 = "sdate1 to sdate2"

Thanks,
Tracktraining
--
Learning


tracktraining

dispay dates return in cell
 
thanks! that works
--
Learning


"Mike" wrote:

Try this
Range("O1").FormulaR1C1 = sdate1 & " to " & sdate


"tracktraining" wrote:

Hi Everyone,

I want to display the dates return in the cell O1. But the following code
writes "sdate1 to sdate2" in the cell instead of something like 2/19/2009 to
2/20/2009. Can anyone help?


Dim sdate1 as Date, sdate2 as Date

sdate1 = Me.StartDate
sdate2 = Me.EndDate

Range("O1").FormulaR1C1 = "sdate1 to sdate2"

Thanks,
Tracktraining
--
Learning



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com