Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,726
Default entering date dd/mmm/yyyy in VB gives mmm/dd/yyyy

Either

Cells(i, j) = CDate(NewDate)

or declare NewDate as type Date and

Cells(i, j) = NewDate

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"mcphc" wrote in message
...
I have some VB code that changes a cells date value to a new date entered
in
by using an inputbox.

Here is some of the code

CellText = Cells(i, j).Value

NewDate = InputBox("Enter new date", "New Date")

Cells(i, j) = Application.WorksheetFunction.Substitute(.Cells(i, j),
CellText, NewDate)

The cell value is say 31/12/2006 and is formatted to show 31-Dec-06. If
the
entered date for NewDate is say 06/01/2007 the new value for the cell
should
be 06/01/2007 and the cell should show 06-Jan-07. But what actually
happens
is the cell value is 01/06/2007 and the cell shows 01-Jun-07.

I have the regional settings of the computer set to English (Ireland).

How do I get the date to enter in Irish format and not american format?




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default entering date dd/mmm/yyyy in VB gives mmm/dd/yyyy

The problem is the cell with the date I'm replacing is sometimes stored as a
date and sometimes stored as text with other text before or after the date
ie. "DATE: 31/12/2007".

The below will work for cell values stored as dates but not cell values
stored as text.

"Bob Phillips" wrote:

Either

Cells(i, j) = CDate(NewDate)

or declare NewDate as type Date and

Cells(i, j) = NewDate

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"mcphc" wrote in message
...
I have some VB code that changes a cells date value to a new date entered
in
by using an inputbox.

Here is some of the code

CellText = Cells(i, j).Value

NewDate = InputBox("Enter new date", "New Date")

Cells(i, j) = Application.WorksheetFunction.Substitute(.Cells(i, j),
CellText, NewDate)

The cell value is say 31/12/2006 and is formatted to show 31-Dec-06. If
the
entered date for NewDate is say 06/01/2007 the new value for the cell
should
be 06/01/2007 and the cell should show 06-Jan-07. But what actually
happens
is the cell value is 01/06/2007 and the cell shows 01-Jun-07.

I have the regional settings of the computer set to English (Ireland).

How do I get the date to enter in Irish format and not american format?





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,726
Default entering date dd/mmm/yyyy in VB gives mmm/dd/yyyy

I don't see why that is a problem, just overwrite it with the date entered
as I showed.

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"mcphc" wrote in message
...
The problem is the cell with the date I'm replacing is sometimes stored as
a
date and sometimes stored as text with other text before or after the date
ie. "DATE: 31/12/2007".

The below will work for cell values stored as dates but not cell values
stored as text.

"Bob Phillips" wrote:

Either

Cells(i, j) = CDate(NewDate)

or declare NewDate as type Date and

Cells(i, j) = NewDate

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"mcphc" wrote in message
...
I have some VB code that changes a cells date value to a new date
entered
in
by using an inputbox.

Here is some of the code

CellText = Cells(i, j).Value

NewDate = InputBox("Enter new date", "New Date")

Cells(i, j) = Application.WorksheetFunction.Substitute(.Cells(i, j),
CellText, NewDate)

The cell value is say 31/12/2006 and is formatted to show 31-Dec-06. If
the
entered date for NewDate is say 06/01/2007 the new value for the cell
should
be 06/01/2007 and the cell should show 06-Jan-07. But what actually
happens
is the cell value is 01/06/2007 and the cell shows 01-Jun-07.

I have the regional settings of the computer set to English (Ireland).

How do I get the date to enter in Irish format and not american format?







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
Format date dd.mm.yyyy to dd/mm/yyyy Kiwi User Excel Discussion (Misc queries) 7 May 7th 23 11:44 AM
change date format from dd/mm/yyyy to mm/yyyy flow23 Excel Discussion (Misc queries) 3 April 4th 23 11:26 AM
Date and Time (entering in the format of mm/dd/yyyy and hh:mm:ss ) Robin Excel Discussion (Misc queries) 9 August 14th 09 11:27 PM
how do I change date from mm/dd/yyyy to dd:mm:yyyy format in Excel Jack Wilson New Users to Excel 4 July 18th 06 01:57 PM
opening excel file - date format problem: DD/MM/YYYY vs MM/DD/YYYY yung Excel Programming 2 March 18th 05 12:50 PM


All times are GMT +1. The time now is 12:45 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"