+ Reply to Thread
Results 1 to 8 of 8

macro help - delete

  1. #1
    Forum Contributor
    Join Date
    04-27-2011
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    113

    macro help - delete

    I have over 5000 rows of data that contain blanks

    I would like where there is a blank for the data to Delete > shift left

    i.e.
    A17:D17 are blanks F17:H17 contain data

    so if A17:D17 are blanks, then move data from F17:H17 to A17:D17 (delete left)

    i would like so it searchs for any blanks in column A:D and replaces it with data in column F:H

    can someone pls help with a macro? thxing u in advance

    pls see sample attached**
    Attached Files Attached Files
    Last edited by step_one; 10-06-2011 at 05:32 PM.

  2. #2
    Valued Forum Contributor Blake 7's Avatar
    Join Date
    10-01-2010
    Location
    Bogota, Colombia
    MS-Off Ver
    Excel 2010 64 bit and Excel 2007,
    Posts
    1,377

    Re: macro help - delete rows left

    How about

    Columns("A:Z").SpecialCells(xlCellTypeBlanks).Delete Shift:=xlToLeft

    This will move all values to the left where possible. it that what yiou are after?
    Last edited by Blake 7; 10-04-2011 at 05:03 PM.
    Blake 7

    If your question has been answered, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

    If any member's response has helped to solve your problem, please consider using the scales icon on the top right of their post to show your appreciation.

    http://failblog.org/

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: macro help - delete rows left

    Hi step_one,

    No code is needed if you can find the GoTo Special Dialog.

    1. Select the range A2:E5000 (where these blank cells are located)
    2. With the range above selected click the GoTo Special Dialog and find BLANK
    3. Click OK from the dialog above and all blanks are now selected in your selected range
    4. Right Click on any of the blank selected cells and click on Delete.
    5. Choose shift left and problem solved.

    I hope this is what you wanted.
    Last edited by MarvinP; 10-04-2011 at 05:31 PM.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Valued Forum Contributor Blake 7's Avatar
    Join Date
    10-01-2010
    Location
    Bogota, Colombia
    MS-Off Ver
    Excel 2010 64 bit and Excel 2007,
    Posts
    1,377

    Re: macro help - delete

    @ Marvin - I think the Macro is much easier should the excercise need repeating on a regular basis.

  5. #5
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: macro help - delete

    If the OP has never seen the VBA editor then it might be harder to teach them to insert a macro than do it manually a few times.

    I looked at the forum and if it was the programming forum then I'd agree they wanted the VBA code. Because it was the Excel General, I gave my manual method.

  6. #6
    Valued Forum Contributor Blake 7's Avatar
    Join Date
    10-01-2010
    Location
    Bogota, Colombia
    MS-Off Ver
    Excel 2010 64 bit and Excel 2007,
    Posts
    1,377

    Re: macro help - delete

    I was just going by the title - Macro Help. Anyway, i thought of you today. I was messing around with dates in a PT and was moving thm up/down individualy to get tham into the right order. I was going to post but you werent online! next time! Cheers Marv

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: macro help - delete

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    PLEASE PM WHEN YOU HAVE DONE THIS AND I WILL DELETE THIS POST
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  8. #8
    Forum Contributor
    Join Date
    04-27-2011
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    113

    Re: macro help - delete

    thx u guys for the great help and the pointers!

+ 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