View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Stefi Stefi is offline
external usenet poster
 
Posts: 2,646
Default How to use macro to edit data in Excel cells

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.