+ Reply to Thread
Results 1 to 4 of 4

Need help writing a Macro In Excel 2010, It's not doing what I need it to do

  1. #1
    Registered User
    Join Date
    09-29-2012
    Location
    Dacula, Georgia
    MS-Off Ver
    Excel 2010
    Posts
    2

    Unhappy Need help writing a Macro In Excel 2010, It's not doing what I need it to do

    Hello, I attempted to write my first macro in excel. I watched a tutorial, everything was going great, but its not working right and I don't know why. I have a spreadsheet that has two columns of text Each column has 6,258 rows. The problem is due to a printout of a directory listing that i moved into notepad then word then excel. What it did is placed a blank space before each set of text in every cell.
    Manually removing it can be done by pressing F2 Home Del Enter....6258 times!!! When i recorded the macro F2 Home Del Enter I named it temp and gave it a ctrl A shortcut. When I ran the shortcut it fixed the first two cells. A1 and A2. They both had " 10 Years" It switched it to "10 years". No space before the 10 years. That was great (p.s. the " are not in the cells). The next 6 cells down's data reads " 3 Doors Down" I was expecting the macro to change it to "3 Doors Down" but it did not. It changed it "10 Years". Not Good, So what did I do wrong? Can the macro recorder not take F2 or Home or Delete or enter?
    Any help would be appreciated
    Thanks
    DOug

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

    Re: Need help writing a Macro In Excel 2010, It's not doing what I need it to do

    Hello douglasd3 ,

    Welcome to the Forum!

    You should upload your workbook for review.

    To Attach a File:
    1. Click on Go Advanced
    2. In the frame Attach Files you will see the button Manage Attachments
    3. Click the button.
    4. A new window will open titled Manage Attachments - Excel Forum.
    5. Click the Browse... button to locate your file for uploading.
    6. This will open a new window File Upload.
    7. Once you have located the file to upload click the Open button. This window will close.
    8. You are now back in the Manage Attachments - Excel Forum window.
    9. Click the Upload button and wait until the file has uploaded.
    10. Close the window and then click Submit.
    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!)

  3. #3
    Registered User
    Join Date
    09-20-2012
    Location
    Wellington, New Zealand
    MS-Off Ver
    Excel 2003
    Posts
    63

    Re: Need help writing a Macro In Excel 2010, It's not doing what I need it to do

    Paste the data back in from Notepad Doug....

    Then use the following formula on an adjacent cell (assuming your " 3 doors down" is in cell A1): =RIGHT(A1,LEN(A1)-1)

    This will remove the first character of A1. Copy this down for all your rows... then Copy the whole column with this formula, select the column with the bad data, then select Paste - Values. Ta daaa, all your spaces have gone

  4. #4
    Registered User
    Join Date
    09-29-2012
    Location
    Dacula, Georgia
    MS-Off Ver
    Excel 2010
    Posts
    2

    Smile Re: Need help writing a Macro In Excel 2010, It's not doing what I need it to do

    Thank you Bobbles so much, I figured there was a formula but I didn't know how to do it. A freidn suggested a Macro, That still would have taken a while to keep running the Macro. This was a perfect Solution!

    Thank you so much


    This problem has been solved. Thank you

+ 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