+ Reply to Thread
Results 1 to 6 of 6

Clear Row

  1. #1
    Forum Contributor
    Join Date
    01-28-2019
    Location
    Malaysia
    MS-Off Ver
    Office 365
    Posts
    162

    Clear Row

    How to clear the blank row between the data such as Row 2 and Row 4?
    Attached Files Attached Files

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

    Re: Clear Row

    Hi alferd,

    This is a job for VBA. Here is one of many websites that shows and explains the code:
    https://www.automateexcel.com/vba/remove-blank-rows/

    The secret is that you must start at the bottom and move up to the top because deleting a blank row moves all rows up If you start at the top and move down, things get screwed up.
    That is why the "Step -1" is needed in most all code that does this.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Clear Row

    Quote Originally Posted by alferd324 View Post
    How to clear the blank row between the data such as Row 2 and Row 4?
    Hi,

    another way is to just sort the range like any beginner can operate manually …

  4. #4
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: Clear Row

    Hi alferd324,

    I totally agree with Marc L but if you really need a macro this will do the job:

    Please Login or Register  to view this content.
    The secret is that you must start at the bottom and move up
    You can start at the first row and move down to the last row but you need to create a range of applicable rows as the code moves down through each row and then deletes them from the created range at the end. This does however add extra lines that are avoided doing the bottom up approach as MarvinP suggests and which I have done here.

    Regards,

    Robert
    Last edited by Trebor76; 03-22-2020 at 08:20 PM.
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  5. #5
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Clear Row


    If really a VBA procedure is needed - easy with the Macro Recorder - it requires only an unique codeline using a sort
    so without any useless looping code …

  6. #6
    Forum Contributor
    Join Date
    01-28-2019
    Location
    Malaysia
    MS-Off Ver
    Office 365
    Posts
    162

    Re: Clear Row

    Thank you for all of your help

+ 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. VBA to Clear 1 Cell and Clear other cells Formula only
    By oneblondebrow in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-17-2017, 12:56 PM
  2. Clear merged cell contents in comand button(clear all)
    By mohan_984 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-25-2015, 10:39 AM
  3. On Close Clear ComboBox1 - ListIndex -1 and Clear not working
    By Janc in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-07-2015, 10:10 AM
  4. Replies: 1
    Last Post: 06-21-2013, 04:05 AM
  5. [SOLVED] can someone help modify the clear command to only clear columns from A-G?
    By psunursingguy21 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-30-2013, 03:52 PM
  6. [SOLVED] Clear button, add warning dialogue box that asks: Are you sure you want to clear?
    By nenadmail in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-21-2012, 02:41 PM
  7. Button to clear sheet and automatic clear rows
    By sandbach in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-29-2010, 02:06 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