+ Reply to Thread
Results 1 to 10 of 10

Find first blank row, count up X number of rows and delete

  1. #1
    Forum Contributor BeachRock's Avatar
    Join Date
    11-01-2011
    Location
    Oregon, United States
    MS-Off Ver
    Excel 2016
    Posts
    403

    Find first blank row, count up X number of rows and delete

    Hello,

    I use a macro to post the outcome of a scoresheet onto 4 different sheets. I would like to have a macro that can basically undo the changes that were just applied by the first macro in case something was forgotten to be added. It has to find the first empty row on those 4 other sheets and then count up a specific number of rows and over a specific number of columns (different for each sheet), select that data and delete/clear it.

    The complete macro I use to post the changes from the outcome of a match is below and is what I need to be able to undo.

    Please Login or Register  to view this content.
    Thanks very much for your help.
    -------------
    Tony

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Find first blank row, count up X number of rows and delete

    Try something like this...

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor BeachRock's Avatar
    Join Date
    11-01-2011
    Location
    Oregon, United States
    MS-Off Ver
    Excel 2016
    Posts
    403

    Re: Find first blank row, count up X number of rows and delete

    Hi AlphaFrog, thanks for the reply. I tried your suggested code and though it doesn't error, it also doesn't seem to do anything...

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Find first blank row, count up X number of rows and delete

    Quote Originally Posted by BeachRock View Post
    Hi AlphaFrog, thanks for the reply. I tried your suggested code and though it doesn't error, it also doesn't seem to do anything...
    Did you run the new UpdateTeamStatsPerMatch macro first? It stores the ranges so you could "undo" them later.

    The four Dim statements have to be located at the top of the code module.

  5. #5
    Forum Contributor BeachRock's Avatar
    Join Date
    11-01-2011
    Location
    Oregon, United States
    MS-Off Ver
    Excel 2016
    Posts
    403

    Re: Find first blank row, count up X number of rows and delete

    No I didn't, sorry. I'll load up a match and then let you know what happens.

  6. #6
    Forum Contributor BeachRock's Avatar
    Join Date
    11-01-2011
    Location
    Oregon, United States
    MS-Off Ver
    Excel 2016
    Posts
    403

    Re: Find first blank row, count up X number of rows and delete

    Hi AlphaFrog,

    I must be doing something wrong. I create the macro you posted just as it looks above. I assigned it to a button on the scorecard sheet. I entered all of the test data into the scorecard and when I pressed the button to apply the results I got an error saying it cant run. In my macro list I now have two items that are different from before.

    Module27.UpdateTeamStatsPerMatch This is the original update code.

    Module34.UpdateTeamStatsPerMatch This is your code.

    Mine is applied to my update button and yours is applied to the Undo button.

  7. #7
    Forum Contributor BeachRock's Avatar
    Join Date
    11-01-2011
    Location
    Oregon, United States
    MS-Off Ver
    Excel 2016
    Posts
    403

    Re: Find first blank row, count up X number of rows and delete

    I just reread your second post. Are you saying I need to run your code prior to running my update macro?

    Maybe I just don't understand how this is intended to work...

  8. #8
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Find first blank row, count up X number of rows and delete

    My new UpdateTeamStatsPerMatch macro replaces your old UpdateTeamStatsPerMatch macro.

    You have to run the new UpdateTeamStatsPerMatch macro once before you are able to undo anything. The new macro copies your data, and it also stores the location where the data was copied so it could be undone later. No need to go "find" it.

    These are the four Undo macros

    Please Login or Register  to view this content.
    Each will undo one sheet's data. You could consolidate them into one Undo Everything macro like this...

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor BeachRock's Avatar
    Join Date
    11-01-2011
    Location
    Oregon, United States
    MS-Off Ver
    Excel 2016
    Posts
    403

    Re: Find first blank row, count up X number of rows and delete

    Works like a charm!! I had a feeling you were replacing what I had. Sorry, AlphaFrog, that just wasn't what I was expecting. Damn good solution though! Thanks very much for your patience with me and for your excellent solution.

  10. #10
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Find first blank row, count up X number of rows and delete

    You're welcome. Glad it works for you.

+ 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