+ Reply to Thread
Results 1 to 6 of 6

Placement of a particular line of code

  1. #1
    Registered User
    Join Date
    11-21-2005
    Posts
    46

    Placement of a particular line of code

    Dear all,

    I have some code which imports a large volume of text file data into Excel, within which I have a 'find and replace' line. Originally I had this placed within a loop, so that it checked the whole worksheet after every line imported - this was obviously a mistake and caused the code to take ages to run. I thought I'd replace the line of code in question to the end of the code, so that it 'finds and replaces' only once. However, I've tried placing the following line of code at numerous positions near the end of the code, but haven't been able to get it to actually perform the find and replace part (i.e. char(13) remains after the code has finished - I do however get an 'input past end of file' error, which may be partly to blame, although all the data does appear to import...?):

    Please Login or Register  to view this content.

    The original code is:

    Please Login or Register  to view this content.
    Does anyone have any ideas?

    Many thanks,
    smurray444

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,475
    it could be
    Chr(10)


    does the code work on its own?
    Last edited by davesexcel; 08-19-2007 at 08:49 AM.

  3. #3
    Registered User
    Join Date
    11-21-2005
    Posts
    46
    The Chr(13) shouldn't be a problem - it's an exotic character which I hope to remove.

    The rest of the code works fine as far as I can tell. It's just that whilst the 'find and replace' bit worked when I had it doing it after every row imported (which would've taken ~200 days to complete!), it no longer seems to work when I ask it to do one big sweep at the end of the entire import (although there is no error relating to it when the code runs, it's just that the exotic character remains!).

    Hope someone is able to offer some advice.

    Thanks again
    smurray444

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,475
    Quote Originally Posted by smurray444
    The Chr(13) shouldn't be a problem - it's an exotic character which I hope to remove.

    The rest of the code works fine as far as I can tell. It's just that whilst the 'find and replace' bit worked when I had it doing it after every row imported (which would've taken ~200 days to complete!), it no longer seems to work when I ask it to do one big sweep at the end of the entire import (although there is no error relating to it when the code runs, it's just that the exotic character remains!).

    Hope someone is able to offer some advice.

    Thanks again
    smurray444
    Thats what I was asking if the find replace code works on it's own,
    What is the symbol, it may be as simple as copying the symbol and then pasting it into the find box(Ctrl v)

  5. #5
    Registered User
    Join Date
    11-21-2005
    Posts
    46
    The symbol is a Unix-based carriage return character (appears as a question mark in a box in Excel). I've tried pasting it in, but it doesn't display (because it's not a standard character I guess).

  6. #6
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,475
    Quote Originally Posted by smurray444
    The symbol is a Unix-based carriage return character (appears as a question mark in a box in Excel). I've tried pasting it in, but it doesn't display (because it's not a standard character I guess).
    Hi, Maybe try
    CHAR(13)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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