PC Review


Reply
Thread Tools Rate Thread

copy date to text

 
 
ulfb
Guest
Posts: n/a
 
      13th Nov 2009
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!


 
Reply With Quote
 
 
 
 
Mike H
Guest
Posts: n/a
 
      13th Nov 2009
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

"ulfb" wrote:

> 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!
>
>

 
Reply With Quote
 
Don Guillett
Guest
Posts: n/a
 
      13th Nov 2009
Sub stringdate()
For Each c In Range("f8:f12")
c.Offset(, 1) = CStr(Format(c.Value, "yyyymmdd"))
Next c
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(E-Mail Removed)
"Mike H" <(E-Mail Removed)> wrote in message
news:CF4D223F-D2B1-4912-AAB7-(E-Mail Removed)...
> 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
>
> "ulfb" wrote:
>
>> 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!
>>
>>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA: Copy a date and paste as text Aaron Rubinstein Microsoft Excel Programming 3 23rd Dec 2009 03:04 AM
Dragging Text or Date Fields to Copy billbrandi Microsoft Excel Misc 2 24th May 2009 11:30 PM
Dragging Text or Date Fields to Copy billbrandi Microsoft Excel Misc 0 24th May 2009 11:01 PM
Copy a calculated date in EXCEL as text martinPP Microsoft Excel Misc 4 10th Mar 2009 03:25 PM
Copy Date to Text =?Utf-8?B?a25vd3Nob3dyb3NlZ3Jvd3M=?= Microsoft Excel Misc 2 25th Oct 2007 09:43 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:10 AM.