ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Concat + dates (https://www.excelbanter.com/excel-programming/282063-concat-dates.html)

No Name

Concat + dates
 
Hi,

I have a Cur Year ( a 4 digit number) a CurMonth (2 digit
num) and a cell.Value (2digit day).

I want to Concatonate these so I have day/month/year to do
a date comparison with another date.

This is what I have but I am getting a datatype error

Set CurDate = (CStr(cell.Value) & "/" & CStr(CurMonth)
& "/" & CStr(CurYear))

or

Set CurDate = (cell.Value & "/" & CurMonth & "/" & CurYear)


.... :(

libby

Concat + dates
 
This may help

curyear = "2003"
curmonth = "05"
mycell = Sheet1.Range("a3")

CurDate = (mycell & "/" & curmonth & "/" & curyear)
CurDate = Format(DateValue(CurDate), "dd/mmm/yyyy")

Libby

-----Original Message-----
Hi,

I have a Cur Year ( a 4 digit number) a CurMonth (2 digit
num) and a cell.Value (2digit day).

I want to Concatonate these so I have day/month/year to

do
a date comparison with another date.

This is what I have but I am getting a datatype error

Set CurDate = (CStr(cell.Value) & "/" & CStr(CurMonth)
& "/" & CStr(CurYear))

or

Set CurDate = (cell.Value & "/" & CurMonth & "/" &

CurYear)


.... :(
.


Dianne

Concat + dates
 
How about:

DateSerial(curYear,curMonth,cell.value)

--
HTH,
Dianne

In ,
typed:
Hi,

I have a Cur Year ( a 4 digit number) a CurMonth (2 digit
num) and a cell.Value (2digit day).

I want to Concatonate these so I have day/month/year to do
a date comparison with another date.

This is what I have but I am getting a datatype error

Set CurDate = (CStr(cell.Value) & "/" & CStr(CurMonth)
& "/" & CStr(CurYear))

or

Set CurDate = (cell.Value & "/" & CurMonth & "/" & CurYear)


... :(




No Name

Concat + dates
 
Thanks guys,

DateSerial(a1,a2,a3) worked perfectly!

-----Original Message-----
How about:

DateSerial(curYear,curMonth,cell.value)

--
HTH,
Dianne

In ,
typed:
Hi,

I have a Cur Year ( a 4 digit number) a CurMonth (2

digit
num) and a cell.Value (2digit day).

I want to Concatonate these so I have day/month/year to

do
a date comparison with another date.

This is what I have but I am getting a datatype error

Set CurDate = (CStr(cell.Value) & "/" & CStr(CurMonth)
& "/" & CStr(CurYear))

or

Set CurDate = (cell.Value & "/" & CurMonth & "/" &

CurYear)


... :(



.



All times are GMT +1. The time now is 03:31 PM.

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