+ Reply to Thread
Results 1 to 19 of 19

I need to create a reset button that will reset rows containing a specific value

  1. #1
    Registered User
    Join Date
    04-02-2016
    Location
    Stavanger, Norway
    MS-Off Ver
    MS Office 2013
    Posts
    19

    I need to create a reset button that will reset rows containing a specific value

    So here is my dilemma, I've created a booking system for my B&B hotel and I need to find a way to delete (reset) all rows with data of my guests that have stayed and checked out of my hotel. It gets extremely frustrating to delete each cell to make room for more bookings as you can imagine. Below is a screenshot of my current excel sheet. I've managed to make a "Reset all stayed bookings" button on the top right of my sheet however I am stuck on the programming of the button in the VBA editor. What I need is to reset all rows containing the word "Hospedado" in column F (It's all in portuguese). However, column H/J/O/R/S/T has code in it and will be reset automatically if the other cells are blank so these must be left alone. I am very confident in excel code however it's my first time venturing into the VBA editor so help would be very much appreciated!

    Best regards,
    Andreas B.

    Booking.png
    Attached Images Attached Images
    Last edited by odin78; 04-02-2016 at 07:50 PM. Reason: Edited photo

  2. #2
    Forum Contributor
    Join Date
    07-13-2015
    Location
    Poland
    MS-Off Ver
    MS Office 365
    Posts
    171

    Re: I need to create a reset button that will reset rows containing a specific value

    Ok,

    Firstly you could show what you have in VBA by now - this is important to see how you built this table (or you used only excel sheet filling in manually?).

    This table is excel 'data table' created from insert menu?

    Which columns indeed you want to delete data from VBA?

  3. #3
    Registered User
    Join Date
    04-02-2016
    Location
    Stavanger, Norway
    MS-Off Ver
    MS Office 2013
    Posts
    19

    Re: I need to create a reset button that will reset rows containing a specific value

    Hi, thanks for the reply. I haven't edited anything in VBA. All coding so far is done outside VBA with "Conditional formatting" and cell formulas. All data on the sheet is filled in manually.

    What I need to do is create a reset button that resets all data in rows containing the word "Hospedado" in row F21:F170. However, there are certain columns that have code in them so I don't want the reset button to "harm" those in any way.

    For example: Row F50 contains the word "Hospedado" therefore when i click the "Reset" button the cells F50:G50 and I50:N50 and P50:Q50 will be cleared.

    I hope I made myself clear and you have a good answer.

    Thanks for the help!

    Regards,
    Andreas B.

  4. #4
    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: I need to create a reset button that will reset rows containing a specific value

    Hi Andreas

    Welcome to the Forum!!!

    Please attach a sample workbook the Structure of which is the same as your actual 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.

    INCLUDE ANY CODE YOU'RE USING OR HAVE TRIED.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.
    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.

  5. #5
    Registered User
    Join Date
    04-02-2016
    Location
    Stavanger, Norway
    MS-Off Ver
    MS Office 2013
    Posts
    19

    Re: I need to create a reset button that will reset rows containing a specific value

    Because of sensitive data on the sheet and details of my guests I cannot share or show the entire workbook.

    I've succesfully created a macro button and managed to code it so it resets the rows containing the word "Hospedado", however I need to make a code for every single row and that's over 150 rows! So that's not going to work.
    The code I've used in the VBA is:

    Please Login or Register  to view this content.
    This works deleting the row F21 however I want it to search the entire column F for the word "Hospedado" and clear the entire row corresponding.

    I've tried this without success

    Please Login or Register  to view this content.
    Basically, to explain as best I can... this is the situation before:
    Before.png

    And when everything is working I want it to look like this AFTER I press the "Reset" button:
    After.png

    The cells are coded so they some are blue and some are red when blank.

    I hope this clears things up.

    Thanks,
    Andreas B.
    Last edited by odin78; 04-03-2016 at 02:04 PM.

  6. #6
    Registered User
    Join Date
    04-02-2016
    Location
    Stavanger, Norway
    MS-Off Ver
    MS Office 2013
    Posts
    19

    Re: I need to create a reset button that will reset rows containing a specific value

    I really need help with this guys... let me explain in a better way...

    This code does exactly what I want:

    Please Login or Register  to view this content.
    That's only for the first row F. I have another 150 rows that need the same coding. So this works as well:

    Please Login or Register  to view this content.
    And so on... if I continue with this code 150 times down I have solved my problem, however, there must be a simpler way to do it? I've tried this and it does NOT work...
    Please Login or Register  to view this content.
    Any ideas?

    Thanks and regards,
    Andreas B.
    Last edited by odin78; 04-03-2016 at 02:04 PM.

  7. #7
    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: I need to create a reset button that will reset rows containing a specific value

    Hi Andreas

    See if this works for you...
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    04-02-2016
    Location
    Stavanger, Norway
    MS-Off Ver
    MS Office 2013
    Posts
    19

    Re: I need to create a reset button that will reset rows containing a specific value

    Thank you, this works almost and clears all "Hospedado" cells in column F, however it only clears the cells in column F and not the rows corresponding to the cells cleared

    Getting closer anyways
    Last edited by odin78; 04-03-2016 at 01:26 PM.

  9. #9
    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: I need to create a reset button that will reset rows containing a specific value

    Hi Andreas

    Sorry, misunderstood...
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    04-02-2016
    Location
    Stavanger, Norway
    MS-Off Ver
    MS Office 2013
    Posts
    19

    Re: I need to create a reset button that will reset rows containing a specific value

    Jaslake, thank you so much, it works great! May I ask one more question, is there a way to skip Column H only, because it clears the code in the cells also and does not work anymore after I reset. The cells in Column H clear automatically if cells in Column G are blank.

  11. #11
    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: I need to create a reset button that will reset rows containing a specific value

    Not tested but should work...
    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    04-02-2016
    Location
    Stavanger, Norway
    MS-Off Ver
    MS Office 2013
    Posts
    19

    Re: I need to create a reset button that will reset rows containing a specific value

    Nevermind Jaslake, I think I cracked it with this code...


    Please Login or Register  to view this content.
    Thanks again!
    Last edited by odin78; 04-03-2016 at 02:03 PM.

  13. #13
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: I need to create a reset button that will reset rows containing a specific value

    Please take a few minutes to read the forum rules, and then edit your post to add CODE tags.

    Thanks.
    Entia non sunt multiplicanda sine necessitate

  14. #14
    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: I need to create a reset button that will reset rows containing a specific value

    You're looping through the Cells twice...which is ok but not necessary.

  15. #15
    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: I need to create a reset button that will reset rows containing a specific value

    Sorry about that shg...completely missed that...

  16. #16
    Registered User
    Join Date
    04-02-2016
    Location
    Stavanger, Norway
    MS-Off Ver
    MS Office 2013
    Posts
    19

    Re: I need to create a reset button that will reset rows containing a specific value

    Sorry Shg, I've edited my posts. New on the forum

  17. #17
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: I need to create a reset button that will reset rows containing a specific value

    No problem, welcome, and thank you.

  18. #18
    Registered User
    Join Date
    04-02-2016
    Location
    Stavanger, Norway
    MS-Off Ver
    MS Office 2013
    Posts
    19

    Re: I need to create a reset button that will reset rows containing a specific value

    Jaslake, your last code works perfectly! Thank you!

  19. #19
    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: I need to create a reset button that will reset rows containing a specific value

    You're welcome...glad I could help.

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

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Thanks for adding Code Tags.

+ 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. Create running stopwatch/timer with 1 button (start/stop). No reset button.
    By leeroy2612 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-26-2021, 12:59 AM
  2. [SOLVED] Reset Button
    By Mick Hassell in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-13-2015, 04:58 AM
  3. [SOLVED] Double click a cell to copy it to another cell & how to create a reset button in excel
    By jjin in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-02-2013, 10:10 AM
  4. Reset Button
    By BJbeans in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-13-2012, 02:26 PM
  5. Create a clear/reset "button"?
    By splenguin in forum Excel General
    Replies: 10
    Last Post: 09-03-2009, 06:12 PM
  6. Reset Button
    By Laker555 in forum Excel General
    Replies: 1
    Last Post: 08-02-2007, 07:05 AM
  7. Reset Button
    By Laker555 in forum Excel General
    Replies: 0
    Last Post: 08-01-2007, 12:33 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