+ Reply to Thread
Results 1 to 14 of 14

Need help with gaps in text when pasting

  1. #1
    Registered User
    Join Date
    09-03-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    37

    Need help with gaps in text when pasting

    Im new to excel and I have used Google a lot when setting up my spreadsheet and now Im experiencing a problem that I can't seem to find the answer to on Google. I was hoping the experts on this site can help me.

    I've got a spread sheet that has macros setup to automatically prefill some cells with data. Im then trying to copy and paste this data to Notepad. Whenever I paste it, there are all kinds of large spaces and gaps in between words that I need taken out. Not taken out completely, but just one small space. I've try the TRIM function but that doens't seem to work. I've attach a screen shot of my spreadsheet and then what it looks like when I paste it into Notepad. Can someone help me? Thank You.


    spreadsheet.JPGNotePad.JPG

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Need help with gaps in text when pasting

    I suspect those "spaces" are actually tabs.
    Try this in Notepad
    • Select one of the tabs
    • CTRL+C...to copy the tab
    • CTRL+H
    ...Find what: (CTRL+V...to paste the tab)
    ...Replace with: <-Enter a space here
    ...Click: Replace All

    Does that fix the problem?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Registered User
    Join Date
    09-03-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    37

    Re: Need help with gaps in text when pasting

    Thanks for the suggestion but I really need a solution within Excel itself so I don't have to repeat these steps over and over in notepad. The data chances with every entry i do and I do around 30 different entry a day.

  4. #4
    Registered User
    Join Date
    05-23-2013
    Location
    California, USA
    MS-Off Ver
    Excel 2010
    Posts
    43

    Re: Need help with gaps in text when pasting

    Quote Originally Posted by Lylestyle89 View Post
    Thanks for the suggestion but I really need a solution within Excel itself so I don't have to repeat these steps over and over in notepad. The data chances with every entry i do and I do around 30 different entry a day.

    Hi lylestly,

    I believe Ron is trying to isolate what it is that is causing the spaces. I believe he is right in that you are pasting tab delimited values from Excel to Notepad. The solution will be based around the delimiter if this is the case. I will try to recreate the issue and see what I can find.

  5. #5
    Registered User
    Join Date
    09-03-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    37

    Re: Need help with gaps in text when pasting

    Ron, I tried what you said and that did not work. It still had the gaps/indents in between the words.

  6. #6
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Need help with gaps in text when pasting

    I suggest that instead of copying and pasting into Notepad, that you export as a CSV file. (Comma Separated Values) This will give you a comma between the cell values that were in Excel.

    If you want to get rid of the commas, then in Notepad select the text that you want to eliminate the commas from and do a Search for , and replace with a space or two.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  7. #7
    Forum Contributor
    Join Date
    08-02-2013
    Location
    Wageningen, The Netherlands
    MS-Off Ver
    365
    Posts
    495

    Re: Need help with gaps in text when pasting

    Or fill column G in your excel file with

    =TRIM(A2&" "&B2&" "&C2&" "&D2&" "&E2&" "&F2)
    in G2 and drag down

    and only copy column G to your notepad file
    When I say semicolon, u say comma!

  8. #8
    Registered User
    Join Date
    09-03-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    37

    Re: Need help with gaps in text when pasting

    Quote Originally Posted by L-Drr View Post
    Or fill column G in your excel file with

    =TRIM(A2&" "&B2&" "&C2&" "&D2&" "&E2&" "&F2)
    in G2 and drag down

    and only copy column G to your notepad file

    This works other than when I do this to the row with the date in it, the date changes to this really long number with a decimal in the middle. Example of how the date looks....... Login Time: 41520.1392361111

  9. #9
    Registered User
    Join Date
    05-23-2013
    Location
    California, USA
    MS-Off Ver
    Excel 2010
    Posts
    43

    Re: Need help with gaps in text when pasting

    Hi Lylestyle,

    I was thinking about your issue and I was going to recommend the same solution as L-Drr, so I'm glad you've had a head start on it.

    The solution to your dates is as follows:

    For the date use this: &TEXT(B1,"mm/dd/yyyy") change B1 to the cell that contains your date.

    For the time use this: &TEXT(D1,"hh.mm AM/PM") change the D1 to the cell that contains your time.

    Example image of change in output:

    Date: 9/3/13 3:20 AM Time: 9/3/13 3:20 AM Date: 41520.1392361111 Time: 41520.1392361111
    Date: 9/3/13 3:20 AM Time: 9/3/13 3:20 AM Date: 09/03/2013 Time: 03.20 AM

    When you paste it into the .txt file you should see the number and decimals are gone and the correct date formatting in its place.

  10. #10
    Registered User
    Join Date
    09-03-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    37

    Re: Need help with gaps in text when pasting

    kelleytr,

    Im not sure if I done what you said correctly, but it didn't work for me. My date on my spreadsheet is now is cell B5. I have text data in A5 that says LOGIN DATE AND TIME: So this is the formula I typed cell N5 (which is the column I choose for all my trim formula stuff) =TRIM(A5&" "&B5&" "&C5&" "&D5&" "&E5&" "&F5&" "&G5&" "&H5) &TEXT(B5,"mm/dd/yyyy")

    This is what the cell N5 looks like after I put that in. LOGIN DATE AND TIME: 41310.6666666667 Then I tried to paste that in Notepad and it still looks the same. The date is still in decimal format. Thanks you for all your help on this matter.

  11. #11
    Registered User
    Join Date
    05-23-2013
    Location
    California, USA
    MS-Off Ver
    Excel 2010
    Posts
    43

    Re: Need help with gaps in text when pasting

    I'm happy to help

    Is it possible for you to make an excel file with no sensitive information that I could look at?

    What you typed appears correct. I might not be seeing something that looking at the spreadsheet would reveal.

  12. #12
    Registered User
    Join Date
    09-03-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    37

    Re: Need help with gaps in text when pasting

    This is going to sound crazy because I have NO idea what Im doing in Excel, but I fixed it. HAHAHAHA I just removed "&B5&" from the first part of the formula. Now it looks like this =TRIM(A5&" "&C5&" "&D5&" "&E5&" "&F5&" "&G5&" "&H5) &TEXT(B5,"mm/dd/yyyy")

    That was pure luck on my part. HAHAHA Thanks everyone for helping me.

    I also dont know how to change the status of this topic to SOLVED.

  13. #13
    Registered User
    Join Date
    06-30-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    70

    Re: Need help with gaps in text when pasting

    I think u hv only one issue left which is Login time stamp row So use this formula

    =TRIM(A4)&TEXT(B4,"mmm. Dd, yyyy")&TEXT(B4,"hh:mm AM/PM")

  14. #14
    Forum Contributor
    Join Date
    08-02-2013
    Location
    Wageningen, The Netherlands
    MS-Off Ver
    365
    Posts
    495

    Re: Need help with gaps in text when pasting

    You can set the topic to Solved by clicking on Thread Tools, just above your first post (to the right) and then click Mark thread as solved. If this is not possible (which would be 2 days after the first post I think), go this this thread: http://www.excelforum.com/the-water-...rk-solved.html
    There you can ask a mod to do it for you.

    Please also consider adding reputation to those who helped you, by clicking the star in the bottom left corner of someone's post.
    Last edited by L-Drr; 09-06-2013 at 06:33 PM.

+ 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. Replies: 4
    Last Post: 05-16-2013, 06:24 AM
  2. using text data from one table and filling in the gaps in another.
    By X-tremejoe in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-05-2012, 08:43 AM
  3. [SOLVED] Charting Date Gaps as Gaps
    By reactant in forum Excel Charting & Pivots
    Replies: 6
    Last Post: 07-10-2012, 12:42 PM
  4. gaps in text converting to new lines
    By ace2302 in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 12-03-2008, 10:30 AM
  5. [SOLVED] Transpose Column With Gaps to Row With No Gaps?
    By SteveC in forum Excel General
    Replies: 5
    Last Post: 06-17-2005, 08:05 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