+ Reply to Thread
Results 1 to 4 of 4

Delete rows, then reorganise remaining data

  1. #1
    Registered User
    Join Date
    04-30-2012
    Location
    London
    MS-Off Ver
    Excel 2013
    Posts
    88

    Delete rows, then reorganise remaining data

    Hi there

    I'm hoping someone can help me delete some rows from a worksheet, then reorganise a lot more.

    I've got an exceptionally slow way of doing it at the moment with millions of lines of very bad code from just recording various steps but it crashes my computer every time so I'm hoping there's a quicker way.

    I've attached a sample document for what the information looks like now and what I'd like it to look like afterwards.

    I've used two sheets for clarity but ideally would like the action to happen over the top on the one sheet. This is not essential though.

    There are three members in the sample but in reality there could be 100s - it will vary each time. The data in A will always follow the same pattern, but in B there may be the odd field that is missing information.

    I'm hoping to have the information in A18:B20 deleted, to follow in this way for each member, so deleting the rows relating to the below, then reorganising the remaining info as per the After sheet.

    Type
    Last Viewed
    Last notified

    Thanks as ever for your help.

    Steve
    Attached Files Attached Files

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Delete rows, then reorganise remaining data

    With consistently laid out data, VBA isn't really needed. Drop the new data into NOW, then these formulas on AFTER will reorganize it:

    A2: =INDEX(Now!A:A,ROWS($A$1:$A1)*21-20) (copied down until blanks appear)

    B2: =IF($A2="", "", INDEX(Now!$B:$B, MATCH($A2, Now!$A:$A, 0)+COLUMNS($A$1:A$1))&"") (copied down and across the remaining table).



    Once all the values are showing, you can highlight the data, then COPY > PASTE SPECIAL > VALUES onto a 3rd sheet to save it permanently with no formulas, leave your other two sheets setup to keep giving you results when you drop new data onto the first sheet.
    Last edited by JBeaucaire; 01-10-2014 at 03:19 AM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Delete rows, then reorganise remaining data

    How to install your new code
    1. Copy the Excel VBA code
    2. Select the workbook in which you want to store the Excel VBA code
    3. Press Alt+F11 to open the Visual Basic Editor
    4. Choose Insert > Module
    5. Edit > Paste the macro into the module that appeared
    6. Close the VBEditor
    7. Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)

    To run the Excel VBA code:
    1. Press Alt-F8 to open the macro list
    2. Select a macro in the list
    3. Click the Run button

    Please Login or Register  to view this content.


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  4. #4
    Registered User
    Join Date
    04-30-2012
    Location
    London
    MS-Off Ver
    Excel 2013
    Posts
    88

    Re: Delete rows, then reorganise remaining data

    You are an amazing man Jerry and have saved me literally hours if not days! For your amusement I'll post the woeful home made code I was using to achieve the same thing. It locked up my laptop every time!

    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)

Similar Threads

  1. Code will delete first 2 rows but not the remaining 10
    By 00Able in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-23-2011, 07:16 AM
  2. Find data and delete remaining rows (For each loop)
    By Rick_Stanich in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-24-2009, 11:45 AM
  3. [SOLVED] Macro to delete sheets and saves remaining file does not properly delete module
    By pherrero in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-21-2005, 08:12 PM
  4. Replies: 0
    Last Post: 06-21-2005, 01:05 PM
  5. [SOLVED] Re: Macro to delete sheets and saves remaining file does not properly delete module
    By pherrero in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-21-2005, 01: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