+ Reply to Thread
Results 1 to 4 of 4

Macro/VBA to Change Order of Rows/Add Rows based on specific text content presence/absence

  1. #1
    Registered User
    Join Date
    04-25-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    24

    Question Macro/VBA to Change Order of Rows/Add Rows based on specific text content presence/absence

    Hello all,

    I'm struggling with creating macros to do the following 2 tasks:

    1. I have an existing spreadsheet of building material data. The first two columns are a Location # and Location Name. The third column over is called "System", and contains entries like "Floor, Wall, Ceiling, etc. I need to reverse the positions of the rows with System = Wall with those starting System = "Ceiling". Current the Wall rows are below the Ceiling rows, and I need the reverse to be true.

    This must be simple but I'm coming up empty. I'd really appreciate some help with it.

    2. This one is a bit more challenging, and I wasn't even sure where to start:

    On the same spreadsheet, I need to add new rows when a Location Name/# combo exists, but doesn't have existing rows where System = Floor, Wall, Ceiling, Pipe or StructureMacro Documentation - Add-Change Rows Example.xlsm. There are 6 other columns to the Right of the System Column, and the leftmost five ideally need to be filled out with the text "N/A". An example new row entry would be (semicolons denote new column): A-01; Corridor; Floor; N/A; N/A; N/A; N/A; N/A; ; (sixth column is left blank)

    Again, really appreciate any help anyone can provide on either of these challenges.

    I've attached an example file with the new entries added manually

    I'm working with Excel 2010 if that makes a difference.

    Thanks,

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Macro/VBA to Change Order of Rows/Add Rows based on specific text content presence/abs

    Hi c,

    You just want to switch the Ceiling and Wall or is there an order in which you want all to adhere?
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    04-25-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: Macro/VBA to Change Order of Rows/Add Rows based on specific text content presence/abs

    Hi,

    For the re-ordering part, all I really need is the swap between Wall and Ceiling rows, so you have all Floor, then all Wall, then all Ceiling rows, and then whatever else is already below. (Instead of the current Floor -> Ceiling -> Wall order).

    Thanks,

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Macro/VBA to Change Order of Rows/Add Rows based on specific text content presence/abs

    Hi c,

    This will order the existing entries by Location:

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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