Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
You also mistook the date: according to the dd.mm.yy. pattern 11.06.06 must
mean June 11, 2006. Looking forward your reply! Regards, Stefi €˛Annamalai€¯ ezt Ć*rta: Thank you. 11.06.06 means in India, dd.mm.yy. i.e., June 06, 2006 in U.S. Style. I will try and let you know the results, soon. Annamalai xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx "Stefi" wrote: Hi Annamalai, Sorry, in my previous post I made an error: 11.06.06 in US style means 6th of November, 2006. Try this: If your Windows language setting is US English with / as date separator and 11.06.06 means 11th of June, 2006 then use this sub: Sub DateConv() Selection.ColumnWidth = 11 For Each cell In Selection If cell.Value = "" Then Exit For x = Mid(cell, 4, 2) & "/" & Left(cell, 2) & "/" & Right(cell, 2) cell.NumberFormat = "dd-mmm-yyyy" cell.Value = DateValue(x) Next cell End Sub If 11.06.06 means 6th of November, 2006 then use this sub: . Sub DateConv() Selection.ColumnWidth = 11 For Each cell In Selection If cell.Value = "" Then Exit For x = Replace(cell, ".", "/") cell.NumberFormat = "dd-mmm-yyyy" cell.Value = DateValue(x) Next cell End Sub Regards, Stefi €˛Stefi€¯ ezt Ć*rta: Does that mean that 11.06.06 in your example is a UK/India style date meaning 11th of June, 2006? Or the problem is that it is a US style date meaning 6th of September, 2006? One more question: How are cells containing these dates formatted? Text? General? Stefi €˛Annamalai€¯ ezt Ć*rta: Thanks for your reply. I have U.S. (English) for dictionary in my computer. In India, the popular date format is dd.mm.yyyy. I tried to use your macro but did not succeed. I will check again and come to you. Annamalai xxxxxxxxxxxxxxxxxxxxxxxxxxxxx "Stefi" wrote: Hi Annamalai, From your examples I supposed that you have UK English language setting (in Windows Regional settings). Post if it's not true! Customize it by setting date separator to "." (fullstop). Then you can use this macro. Select ALL cells (say a column) you want to convert, then run the macro! Sub DateConv() For Each cell In Selection Selection.ColumnWidth = 11 If cell.Value = "" Then Exit For x = cell.Value cell.NumberFormat = "dd-mmm-yyyy" cell.Value = DateValue(x) Next cell End Sub Regards, Stefi €˛€¯ ezt Ć*rta: Aim: Data from SAP is in label form like 11.06.06 and I would like to convert them to data to berecognized by Excel in date format. The macro recorded is: Sub Macro1() ' ' Macro1 Macro ' Macro recorded 9/19/2006 by Annamalai ' ' Keyboard Shortcut: Ctrl+z ' ActiveCell.FormulaR1C1 = "11-Sep-2006" Range("F10").Select End Sub Data used: 11-Sep-06 11-Sep-06 22.05.06 11-Sep-06 Top cell was manually edited and macro recorded. Bottom 2&4 were the result after macro use(first cell repeats). Cell 3, is raw data, waiting conversion. Annamalai xxxxxxxxxxxxxxxxxxxxx "Stefi" wrote: Post your macro! Stefi €˛Annamalai€¯ ezt Ć*rta: I use macros by recording, not familiar with Visual Basics. I want to edit the cell content of similar cells . When I run the macro on other cells it takes the information from the very first cell and keeps repeating the info on the first cell. What is wrong? Is there any Excel short cut like Lotus 123, macro "?" to represent to "hold and fill" while the macro is running. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
macro | Excel Discussion (Misc queries) | |||
Retrieve data from separate Excel session | Charts and Charting in Excel | |||
From several workbooks onto one excel worksheet | Excel Discussion (Misc queries) | |||
Help PLEASE! Not sure what answer is: Match? Index? Other? | Excel Worksheet Functions | |||
Macro to delete data in 'green' cells only | Excel Worksheet Functions |