Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Copy specific text from notepad into Excel

Hello all,

Can we copy a number/text from a text file which is in a specific
colomn and row in a text file( 10 spaces long)
and then paste it in the excel sheet. I don't want to use the import
command cuz my text file is not delimited.
There are number randomly placed in the text file which I need to copy
and paste it in the excel cells.

I want to place a button on my spreadsheet which would help the user to

locate the data file and then excel would extract data from that sheet
and paste it in the black spaces on the sheet.

Please Help !!!

Thanks,

Riggi

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default Copy specific text from notepad into Excel

It is easier to open the text file as a vba internal processing file and read
the data rather than using the standard open method.

You can still use the standard dialog to get the file name but then open and
process the file.

The code would be

Sub doit()
Dim fileToOpen As Variant
Dim s As String
fileToOpen = Application _
.GetOpenFilename("Text Files (*.txt), *.txt")
If fileToOpen = False Then
Exit Sub
End If
Open fileToOpen For Input As #1
Line Input #1, s
Close #1
ans = Mid(s, 20, 10)
End Sub

Modify it to meet your requirments.
--
Hope this helps
Martin Fishlock, Bangkok, Thailand
Please do not forget to rate this reply.


"Riggi" wrote:

Hello all,

Can we copy a number/text from a text file which is in a specific
colomn and row in a text file( 10 spaces long)
and then paste it in the excel sheet. I don't want to use the import
command cuz my text file is not delimited.
There are number randomly placed in the text file which I need to copy
and paste it in the excel cells.

I want to place a button on my spreadsheet which would help the user to

locate the data file and then excel would extract data from that sheet
and paste it in the black spaces on the sheet.

Please Help !!!

Thanks,

Riggi


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Copy specific text from notepad into Excel

Thanks, it work!! :)


Martin Fishlock wrote:
It is easier to open the text file as a vba internal processing file and read
the data rather than using the standard open method.

You can still use the standard dialog to get the file name but then open and
process the file.

The code would be

Sub doit()
Dim fileToOpen As Variant
Dim s As String
fileToOpen = Application _
.GetOpenFilename("Text Files (*.txt), *.txt")
If fileToOpen = False Then
Exit Sub
End If
Open fileToOpen For Input As #1
Line Input #1, s
Close #1
ans = Mid(s, 20, 10)
End Sub

Modify it to meet your requirments.
--
Hope this helps
Martin Fishlock, Bangkok, Thailand
Please do not forget to rate this reply.


"Riggi" wrote:

Hello all,

Can we copy a number/text from a text file which is in a specific
colomn and row in a text file( 10 spaces long)
and then paste it in the excel sheet. I don't want to use the import
command cuz my text file is not delimited.
There are number randomly placed in the text file which I need to copy
and paste it in the excel cells.

I want to place a button on my spreadsheet which would help the user to

locate the data file and then excel would extract data from that sheet
and paste it in the black spaces on the sheet.

Please Help !!!

Thanks,

Riggi



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Copy specific text from notepad into Excel

Thanks, it worked! :)


Martin Fishlock wrote:
It is easier to open the text file as a vba internal processing file and read
the data rather than using the standard open method.

You can still use the standard dialog to get the file name but then open and
process the file.

The code would be

Sub doit()
Dim fileToOpen As Variant
Dim s As String
fileToOpen = Application _
.GetOpenFilename("Text Files (*.txt), *.txt")
If fileToOpen = False Then
Exit Sub
End If
Open fileToOpen For Input As #1
Line Input #1, s
Close #1
ans = Mid(s, 20, 10)
End Sub

Modify it to meet your requirments.
--
Hope this helps
Martin Fishlock, Bangkok, Thailand
Please do not forget to rate this reply.


"Riggi" wrote:

Hello all,

Can we copy a number/text from a text file which is in a specific
colomn and row in a text file( 10 spaces long)
and then paste it in the excel sheet. I don't want to use the import
command cuz my text file is not delimited.
There are number randomly placed in the text file which I need to copy
and paste it in the excel cells.

I want to place a button on my spreadsheet which would help the user to

locate the data file and then excel would extract data from that sheet
and paste it in the black spaces on the sheet.

Please Help !!!

Thanks,

Riggi



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
How can I copy plain text from Excel to Notepad? ymgagnon Excel Discussion (Misc queries) 5 October 1st 09 09:26 PM
Copy Excel Tab delimited to Notepad tcmh Excel Discussion (Misc queries) 1 May 3rd 09 10:55 PM
How do i copy columns of data in notepad into microsoft excel? JP New Users to Excel 2 February 10th 05 09:47 PM
How do i copy columns of data in notepad into excel? JJ Excel Discussion (Misc queries) 1 February 10th 05 09:21 PM
How do i copy columns of data in notepad into microsoft excel? Jason Excel Discussion (Misc queries) 1 February 10th 05 09:20 PM


All times are GMT +1. The time now is 02:15 AM.

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

About Us

"It's about Microsoft Excel"