+ Reply to Thread
Results 1 to 6 of 6

Reset worksheet to original version, after VBA runs

  1. #1
    Registered User
    Join Date
    09-19-2014
    Location
    Philadelphia,PA
    MS-Off Ver
    2010
    Posts
    54

    Reset worksheet to original version, after VBA runs

    Hi all,

    So I have a Button that, when clicked, runs VBA codes that first deletes empty rows, then emails my company a copy of the sheet, and then allows the user to print the sheet. However, what I need is an additional code that resets all the information on the excel document to its original sheet.

    Basically, I have a list of accounts on a master sheet that are sent out to a customer for verification. In the workbook, there is a hidden "Sheet2" tab. Sheet2, is basically a mirror image of the master accounts with some added verbiage. Once the customer is done verifying the accounts on the master sheet, it hits a submit button that runs the actions i described above. Since the accounts that will populate sheet two vary from 1,000 to 5 accounts, depending on the customer, I have included a VBA that deletes rows from the bottom so it can print properly.

    After the actions are through, I need to re-add the rows ON SHEET 2 (not the master sheet) that were deleted (formulas and formatting).

    If anyone has any ideas, please let me know!

    I have included the VBA below.

    Thank you!

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Reset worksheet to original version, after VBA runs

    Hi,

    Perhaps stating the obvious I suppose but why don't you create a workbook variable for the current workbook name (say stMyWbName) and save the workbook immediately before running the delete stuff macro and then make the last lines of the macro a
    Please Login or Register  to view this content.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    09-19-2014
    Location
    Philadelphia,PA
    MS-Off Ver
    2010
    Posts
    54

    Re: Reset worksheet to original version, after VBA runs

    I actually did not think of that! That's a great idea. How would I go about doing that?

  4. #4
    Registered User
    Join Date
    09-19-2014
    Location
    Philadelphia,PA
    MS-Off Ver
    2010
    Posts
    54

    Re: Reset worksheet to original version, after VBA runs

    Or maybe save the workbook, run the 3 vbas, exit without saving and then open the saved original?

  5. #5
    Valued Forum Contributor bulina2k's Avatar
    Join Date
    11-20-2012
    Location
    Urziceni, Ialomita, Romania
    MS-Off Ver
    2019 and 365
    Posts
    861

    Re: Reset worksheet to original version, after VBA runs

    Hello
    There's an idea, maybe you could create a copy of the sheet2 and work on it (delete/print/send etc..). Something as:
    Please Login or Register  to view this content.
    .. and don't forget to have fun!
    Bogdan.

    mark SOLVED and Add Reputation if my answer pleases you

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

    Re: Reset worksheet to original version, after VBA runs

    Hi KT,

    Set up your module like this:

    Please Login or Register  to view this content.
    And run the Get before you edit sheet 2, then, when you're done run the put
    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

+ 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. Reset to original values in pivot table
    By lbabli in forum Excel Charting & Pivots
    Replies: 5
    Last Post: 03-21-2014, 02:18 PM
  2. Help: Reset input data back to original
    By jasonj427 in forum Excel General
    Replies: 5
    Last Post: 01-22-2013, 01:49 AM
  3. Excel 2007 : Saving the original version of invoice
    By Mickmac in forum Excel General
    Replies: 5
    Last Post: 12-20-2011, 03:24 AM
  4. Replies: 8
    Last Post: 04-20-2011, 09:45 AM
  5. Replies: 4
    Last Post: 02-25-2009, 03:16 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