+ Reply to Thread
Results 1 to 6 of 6

Copy data from notepad into excel

  1. #1
    Registered User
    Join Date
    05-15-2014
    MS-Off Ver
    Excel 2003
    Posts
    22

    Copy data from notepad into excel

    hi

    I have a folder with a lot of notepad files. I need to extract certain info from each file for example as per attached notepad file opened in excel
    see sheet 2
    company name is the heading and below it I want to copy the company name etc.

    Is it possible to this with a macro ?
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Copy data from notepad into excel


    Hi,

    if text files, it's possible, just read VBA inner help of Open, Input # and Line Input # statements …

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Copy data from notepad into excel

    Hello platesigns,

    Is the Notepad file on sheet 8f30f76f-e047-489a-9e6f-43f0ade?

    If so then your text file is actually the page source for an HTML file. Is this format the same for all files in the folder?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Copy data from notepad into excel

    Hello platesigns,

    The attached workbook has the macro code shown below installed. There is a button on "Sheet1" to run the macro.

    The macro assumes the text files are in the same folder as the workbook. If the files are not in this folder, change the macro variable Folderpath (in blue font) to where your files are saved.

    Module1 Macro Code
    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    05-15-2014
    MS-Off Ver
    Excel 2003
    Posts
    22

    Re: Copy data from notepad into excel

    hi

    yes the notepad file I imported into sheet 8f30f76f-e047-489a-9e6f-43f0ade
    but the problem is some files have less lines then others and some have more so it complicates it for me if I search by line no.

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Copy data from notepad into excel

    Hello platesigns,

    The attached workbook will open all text files in the same folder that the workbook is saved in. This will occur when the workbook opens or you manually click the button on "Sheet1".

    You can change the folder location in the macro CopyFileData in Module1. If your worksheet name is not "Sheet1" then you will need to change this match your sheet's name.

    How this works is each text file is read and converted into an HTML file. The elements of the HTML file are scanned and the data is collected. The collected data is the output to the next empty row of the worksheet.

    Here are the macros...

    ThisWorkbook Module
    Please Login or Register  to view this content.
    Moudle1 Macros
    Please Login or Register  to view this content.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. vbscript to copy data from excel to notepad
    By samiulla.warimani in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-20-2014, 10:27 PM
  2. Macro to copy data from excel to notepad
    By emmamaki in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 05-19-2014, 03:42 AM
  3. [SOLVED] Copy excel data to notepad.
    By 111StepsAhead in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-24-2012, 08:56 AM
  4. [SOLVED] How do i copy columns of data in notepad into excel?
    By JJ in forum Excel General
    Replies: 1
    Last Post: 02-10-2005, 06:06 PM
  5. [SOLVED] How do i copy columns of data in notepad into microsoft excel?
    By JP in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 02-10-2005, 06:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1