+ Reply to Thread
Results 1 to 7 of 7

Userform Cancel edit that restores all original values?

  1. #1
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Falmouth, VA now, Palm Bay, FL for 2 yrs, was Colorado Springs, CO for ten years; Cedark Park, TX; Zeeland, MI; Wilmette, IL; Princeton Junction, NJ; NY, NY
    MS-Off Ver
    365
    Posts
    583

    Userform Cancel edit that restores all original values?

    Is there any "trick" out there so when a user presses the command button that allows them to cancel instead of save changes on a user form the original values are restored, other than saving all the textboxes, comboboxes, listboxes, check boxes, ..., to variables/an array and then restoring them? I'm afraid I have two rather involved userforms that will take a bit of work to restore original values-

    Thank-you for thinking about it!

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Userform Cancel edit that restores all original values?

    The simplest way is not to sve any changes until you are ready.

    Then use a save button to save all the changes at the same time.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Userform Cancel edit that restores all original values?

    Hi brucemc77

    How are all the textboxes, comboboxes, listboxes, check boxes being populated with the original values...UserForm Initialize Event?
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  4. #4
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Userform Cancel edit that restores all original values?

    Hi brucemc77,

    To allow us to best assist you in this case is to, attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Because browsers behave differently, many of our members cannot see uploaded images. Do not upload a picture of your file as this will only delay getting solutions.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  5. #5
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Falmouth, VA now, Palm Bay, FL for 2 yrs, was Colorado Springs, CO for ten years; Cedark Park, TX; Zeeland, MI; Wilmette, IL; Princeton Junction, NJ; NY, NY
    MS-Off Ver
    365
    Posts
    583

    Re: Userform Cancel edit that restores all original values?

    Controls are being populated whenever a combobox that serves as an index of all of the records (rows) on a worksheet changes value and are brought in by reference to the worksheet in one instance, by loading all of the values dumped into the combobox list in another. User has the option to hit a command button that enables editing. Yes, I could simply reload the userform, but compared to reinstating original values from an array, reloading looks pretty poor.

    Now that I wrote this it occurs to me (Thanks jaslake!) that I should be able to keep the form up and just run the portion of code that loaded all the values in from a purpose built module...

    If that works, and I see no reason it shouldn't, dang do I feel embarrassed...

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Userform Cancel edit that restores all original values?

    Hi brucemc77

    When I was in the "Business" many years ago designing systems, we, the "Users" and the IT guy(s) (never had more than 2) would sit around the conference room table with a White Board at the end. The IT guy(s) would flow chart the "Users" ideas. It was a painful but productive process.

    Long story short...someone would make a comment...suddenly someone (a "User" or an IT guy) would have an "AH HA" moment...that's what you've had...
    I should be able to keep the form up and just run the portion of code that loaded all the values in from a purpose built module...
    Let us know how it goes...good hunting.

  7. #7
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Falmouth, VA now, Palm Bay, FL for 2 yrs, was Colorado Springs, CO for ten years; Cedark Park, TX; Zeeland, MI; Wilmette, IL; Princeton Junction, NJ; NY, NY
    MS-Off Ver
    365
    Posts
    583

    Re: Userform Cancel edit that restores all original values?

    Just glad all you folks are understanding; especially when my "AH HA" moment is more like a "Oh no, I didn't just do that!" moment!

+ 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. How make edit buttons carry original data validation in userform
    By girivba in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-24-2015, 05:29 AM
  2. [SOLVED] Open a userform from a userform, but preserve the info in the original userform
    By jfoerch in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-25-2013, 02:38 PM
  3. Inputbox Cancel returns null value, can replace with original cell data
    By bg_enigma1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-23-2012, 05:08 PM
  4. How do i edit what happens when cancel is clicked in an inputbox. NEWBIE NEEDS HELP!
    By 10121730 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-31-2012, 03:59 PM
  5. Excel VBA Userform - Sets of data, View original, add new, edit existing
    By newzealdan in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-27-2011, 03:54 AM
  6. Excel automatically restores down
    By wmorrison49 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-27-2008, 02:03 PM
  7. userform won't use entered values, hide, or cancel properly
    By fern in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-12-2005, 07:50 PM

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