Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 61
Default export file from txt (Notepad)

Hi to all

I have open exported file of notepad (TXT Format) Where i have data like
date, item,amtin,amtout,bal.
where data format is DD-MM-YYYY (05-01-2005)
the problem is when i conver this data from text to column, date comes in
number format like 20050105.

is there any way i can put seprater(-) after 4 character and than after 2
charcter (like 2005-01-05 )
any help

Thanks

****al shah

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 212
Default export file from txt (Notepad)

Hello ****al

Assign the Date read from the txt file to a variable.
In below example I assume that you assigned it to variable name "xyz". You
can replace xyz with your variable.

'You already assigned it to variable xyz
Dim myDate As Date
myDate = DateSerial(Left(xyz, 4), Mid(xyz, 5, 2), Right(xyz, 2))

'Now myDate is correct date
'you can assign it to a cell value uisng = myDate
'it will show as say 5/1/2005 if the cell format is Date "d/M/yyy"

'Or if you must have it in "year-month-day" format you can use:
Dim strDate As String
strDate = Left(xyz, 4) & "-" & Mid(xyz, 5, 2) & "-" & Right(xyz, 2)

'And assign it to cell value using = strDate

Sharad

"****al shah" wrote in message
...
Hi to all

I have open exported file of notepad (TXT Format) Where i have data like
date, item,amtin,amtout,bal.
where data format is DD-MM-YYYY (05-01-2005)
the problem is when i conver this data from text to column, date comes in
number format like 20050105.

is there any way i can put seprater(-) after 4 character and than after 2
charcter (like 2005-01-05 )
any help

Thanks

****al shah



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 61
Default export file from txt (Notepad)

Hello Mr. Sharad Naik

you have replyed my question on dt. 8th Jan 05 but still can't find a
solution i don't have more knowladge of macro so where to put lines

Dim myDate As Date
myDate = DateSerial(Left(xyz, 4), Mid(xyz, 5, 2), Right(xyz, 2))

and how to work if you can help me it's a grate help to me.
and soory to reply you in your direct E-mail ID.

regards

****al

"Sharad Naik" wrote:

Hello ****al

Assign the Date read from the txt file to a variable.
In below example I assume that you assigned it to variable name "xyz". You
can replace xyz with your variable.

'You already assigned it to variable xyz
Dim myDate As Date
myDate = DateSerial(Left(xyz, 4), Mid(xyz, 5, 2), Right(xyz, 2))

'Now myDate is correct date
'you can assign it to a cell value uisng = myDate
'it will show as say 5/1/2005 if the cell format is Date "d/M/yyy"

'Or if you must have it in "year-month-day" format you can use:
Dim strDate As String
strDate = Left(xyz, 4) & "-" & Mid(xyz, 5, 2) & "-" & Right(xyz, 2)

'And assign it to cell value using = strDate

Sharad

"****al shah" wrote in message
...
Hi to all

I have open exported file of notepad (TXT Format) Where i have data like
date, item,amtin,amtout,bal.
where data format is DD-MM-YYYY (05-01-2005)
the problem is when i conver this data from text to column, date comes in
number format like 20050105.

is there any way i can put seprater(-) after 4 character and than after 2
charcter (like 2005-01-05 )
any help

Thanks

****al shah




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
Importing from a Notepad file [email protected] New Users to Excel 2 December 8th 11 11:49 PM
Notepad or .txt file to excel nathan Excel Worksheet Functions 3 December 1st 09 09:44 PM
Writing to notepad file Jeff Excel Discussion (Misc queries) 2 October 23rd 06 03:16 AM
Export notepad file to Excel Carrie Excel Discussion (Misc queries) 2 February 2nd 06 05:36 PM
copy excell file to a CSV file and than to Notepad need to know bob Excel Discussion (Misc queries) 0 August 23rd 05 07:27 PM


All times are GMT +1. The time now is 12:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"