copy date to text

  • Thread starter Thread starter ulfb
  • Start date Start date
U

ulfb

Hi
One column contains excel dates, formatted like: 2009-11-09.
What I need is to programmatically create a new column containing text only:
20091109
Any help higly appreciated!
 
Hi,

Try this

Sub stance()
Dim MyRange As Range
Dim LastRow As Long
LastRow = Cells(Cells.Rows.Count, "A").End(xlUp).Row
Set MyRange = Range("A1:A" & LastRow)
For Each c In MyRange
c.Offset(, 1).Value = Format(c.Value, "yyyymmdd")
Next
End Sub


Mike
 
Sub stringdate()
For Each c In Range("f8:f12")
c.Offset(, 1) = CStr(Format(c.Value, "yyyymmdd"))
Next c
End Sub
 
Back
Top