+ Reply to Thread
Results 1 to 4 of 4

VBA FIND Function, User Edit then upon cancel continue VBA

  1. #1
    Registered User
    Join Date
    06-07-2018
    Location
    BG, OH
    MS-Off Ver
    2016
    Posts
    3

    VBA FIND Function, User Edit then upon cancel continue VBA

    I want the user to be able to find each cell matching the What, make changes to any it finds, then upon cancel, continue the VBA to the next What and so on until done with these three searches. Everything I know about VBA comes from searching the internet, so I am missing the fundamentals. Thank you for your time!

    Please Login or Register  to view this content.
    Last edited by 6StringJazzer; 01-25-2019 at 10:44 AM. Reason: Added code tags

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: VBA FIND Function, User Edit then upon cancel continue VBA

    Quote Originally Posted by christinelennard View Post
    make changes to any it finds
    Do you want the user to be able to change the cell that was found, or something else, like another cell on the same row?

    There are a couple of problems in your code.

    I am not sure what you are doing with the SendKeys since you are already using Find to find the cell. You need a loop for each value that you are trying to find. The tricky part is having a loop and also giving the user a chance to make an edit during the loop. The way I would do that is each time the value is found, present an InputBox with the value and give the user a chance to change it there.

    Also I discourage you from using Find as the name of a Sub since it is also a method on Range. It will probably still work but could potentially be a problem later.

    You wrote a With clause but then never used it to make a reference. Maybe you are unclear on how it works.

    I have attached a file with a solution. The code will run on the sheet called Format. This is not a bulletproof solution. If the user hits Cancel when the input box comes up, the cell will be blanked out. If that is too dangerous for you then it needs a custom userform to make the update.
    Attached Files Attached Files
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    06-07-2018
    Location
    BG, OH
    MS-Off Ver
    2016
    Posts
    3

    Re: VBA FIND Function, User Edit then upon cancel continue VBA

    Thank you this worked awesome!!!!!

  4. #4
    Registered User
    Join Date
    06-07-2018
    Location
    BG, OH
    MS-Off Ver
    2016
    Posts
    3

    Re: VBA FIND Function, User Edit then upon cancel continue VBA

    If the first found cell's data is Deleted because the data is not wanted, the macro stays in the loop. Is there a way around that? If not I will just always macro those words in a hidden cells at the beginning and not delete them so it will always find the first one in order to move on. Thanks again for your help!

+ 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. Show UserForm with Continue/Cancel buttons, allowing user to edit sheet
    By dancing-shadow in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 01-16-2017, 05:33 AM
  2. [SOLVED] Show UserForm with Continue/Cancel buttons, allowing user to edit sheet
    By dancing-shadow in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-10-2017, 06:48 AM
  3. Vba code for find and edit in the user form
    By smsrr_79 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-18-2015, 03:50 AM
  4. [SOLVED] Message Box: Continue with Macro or cancel process
    By Student1990 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-11-2013, 03:03 PM
  5. Message Box Prompt. Continue Or Cancel
    By ashleys.nl in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-12-2011, 02:30 PM
  6. Userform - Continue and cancel command buttons code
    By Jessica.Bush in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-01-2010, 04:42 PM
  7. Cancel Macro is user selects 'cancel' at save menu
    By Mark in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-06-2005, 01:06 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