+ Reply to Thread
Results 1 to 4 of 4

Write data to an existing textfile

  1. #1
    Forum Contributor
    Join Date
    04-24-2012
    Location
    Karlstad, Sweden
    MS-Off Ver
    Excel 2016
    Posts
    232

    Write data to an existing textfile

    I want to:
    1. Open an existing textfile
    2. Find a certain string
    3. Increase the number at string by one (+1)
    4. Store and close textfile

    Example:
    Find string B and increase number by one

    Before
    A: 1
    B: 2
    C: 5

    After
    A: 1
    B: 3
    C: 5

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Write data to an existing textfile

    can you attach a real text file ?
    If solved remember to mark Thread as solved

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Write data to an existing textfile

    Hi, Joakim N,

    assuming that the string to search is in cell B2 on the active sheet you should alter Path, Folder and name of the text file to suit:
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  4. #4
    Forum Contributor
    Join Date
    04-24-2012
    Location
    Karlstad, Sweden
    MS-Off Ver
    Excel 2016
    Posts
    232

    Re: Write data to an existing textfile

    Thanks,
    I thought it was possible to write directly in a textfile with content already. Now it solved by reading data from a stored textfile, make the changes, write data to a new textfile and write over the old stored textfile.

    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. apply existing List, if formula is true, otherwise write text data in cell
    By Lynn Porter in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-07-2013, 08:03 PM
  2. Macros code to Import textfile to existing sheet
    By luckygrass711 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-08-2012, 10:51 PM
  3. Write data to existing worksheet row from userform
    By EMAP in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-04-2012, 07:39 AM
  4. Pick textfile in combobox and read last entry in textfile to sheet!
    By Petter120 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-09-2012, 07:11 AM
  5. Write text from textbox into external textfile?
    By proepert in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-16-2010, 01:59 AM

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