Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 199
Default How can I stop automatic date formatting?



I have spreadsheet into which I regularly copy and paste a data table
from a website. The website table shows dates as, for example, Dec 31
and when these are pasted into my spreadsheet they then appear as Dec-31
and if I click on the cell it actually contains 01/12/1931! I presume
this is because of the way Excel (2003) tries to (helpfully!) recognise
what it thinks is a date.

Is there a way to stop this happening please?

Alternatively, is there a way to extract the real date, in this case 31
Dec 2014, from theses cells. I have tried using RIGHT and MID functions
but don't seem to get to the right result.

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,872
Default How can I stop automatic date formatting?

Hi,

Am Fri, 2 Jan 2015 23:35:07 -0000 schrieb Victor Delta:

I have spreadsheet into which I regularly copy and paste a data table
from a website. The website table shows dates as, for example, Dec 31
and when these are pasted into my spreadsheet they then appear as Dec-31
and if I click on the cell it actually contains 01/12/1931! I presume
this is because of the way Excel (2003) tries to (helpfully!) recognise
what it thinks is a date.


if you do not need the date for calculations format the column as text
BEFORE inserting the data.
What date do want into the cell? Always the last of month?
You could try:
=DATE(2014,MONTH(A1)+1,0)
Or you use VBA:

Sub DateFormat()
Dim LRow As Long
Dim rngC As Range

With ActiveSheet
LRow = .Cells(Rows.Count, 1).End(xlUp).Row
For Each rngC In .Range("A1:A" & LRow)
rngC = DateSerial(2014, Month(rngC) + 1, 0)
rngC.NumberFormat = "MMM DD"
Next
End With
End Sub

If you want the last two digits as day instead year try:
=DATE(2014,MONTH(A1),MOD(YEAR(A1),1900))


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 199
Default How can I stop automatic date formatting?

In article , claus_busch@t-
online.de says...

Hi,

Am Fri, 2 Jan 2015 23:35:07 -0000 schrieb Victor Delta:

I have spreadsheet into which I regularly copy and paste a data table
from a website. The website table shows dates as, for example, Dec 31
and when these are pasted into my spreadsheet they then appear as Dec-31
and if I click on the cell it actually contains 01/12/1931! I presume
this is because of the way Excel (2003) tries to (helpfully!) recognise
what it thinks is a date.


if you do not need the date for calculations format the column as text
BEFORE inserting the data.
What date do want into the cell? Always the last of month?
You could try:
=DATE(2014,MONTH(A1)+1,0)
Or you use VBA:

Sub DateFormat()
Dim LRow As Long
Dim rngC As Range

With ActiveSheet
LRow = .Cells(Rows.Count, 1).End(xlUp).Row
For Each rngC In .Range("A1:A" & LRow)
rngC = DateSerial(2014, Month(rngC) + 1, 0)
rngC.NumberFormat = "MMM DD"
Next
End With
End Sub

If you want the last two digits as day instead year try:
=DATE(2014,MONTH(A1),MOD(YEAR(A1),1900))


Regards
Claus B.


Many thanks for that.
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
Stop automatic formatting of cells (number, text, date, etc) Marcela Excel Worksheet Functions 4 June 9th 08 08:09 PM
automatic date formatting Terry Freedman Excel Discussion (Misc queries) 1 October 31st 07 09:40 AM
How can I stop date formatting? Bruce Bolio Excel Programming 2 March 9th 07 03:32 PM
import /paste -stop automatic conversion of text 05-12345 to date artech Excel Discussion (Misc queries) 1 August 20th 06 09:09 PM
Automatic date formatting Vidz Excel Discussion (Misc queries) 3 October 27th 05 11:42 AM


All times are GMT +1. The time now is 06:54 PM.

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"