+ Reply to Thread
Results 1 to 6 of 6

How to target the row that the button that has been clicked is in.

  1. #1
    Registered User
    Join Date
    01-25-2018
    Location
    london
    MS-Off Ver
    365
    Posts
    43

    How to target the row that the button that has been clicked is in.

    Hi all,

    I'm working on a sheet where I want the button when it is clicked to hide the current row and show the next one (that is already hidden). At the moment I am doing it by creating a macro for every single row.
    For example:
    Please Login or Register  to view this content.
    What i'd like to do is to have just one bit of code I can apply to every button that does the above but a generalised version (at the moment I've got 3 bits of code per row and i'm up to 20. I'd love not to have to copy/paste and change the numbers!).

    I managed to find a way to target the current row if the mouse has selected a cell in that row BUT not if the button in that row is clicked.

    Anyone any thoughts?
    Last edited by Oriya; 07-23-2019 at 06:26 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,502

    Re: How to target the row that the button that has been clicked is in.

    Administrative Note:

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    01-25-2018
    Location
    london
    MS-Off Ver
    365
    Posts
    43

    Re: How to target the row that the button that has been clicked is in.

    Sorry I didn't realise! All changed.

  4. #4
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,126

    Re: How to target the row that the button that has been clicked is in.

    How about
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-25-2018
    Location
    london
    MS-Off Ver
    365
    Posts
    43

    Re: How to target the row that the button that has been clicked is in.

    Thank you so much Fluff13, that is amazing! This saves me so much work!

  6. #6
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,126

    Re: How to target the row that the button that has been clicked is in.

    You're welcome & thanks for the feedback

+ 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. VBA: Pop up after button clicked
    By ccwbass in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-21-2017, 01:39 AM
  2. Replies: 5
    Last Post: 12-16-2014, 05:47 PM
  3. How to input data from a clicked on Hyperlinked Cell into the target cell
    By SoCalSQ in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-05-2012, 11:18 AM
  4. Modifying a Macro Button to time stamp when the button was clicked.
    By jonvanwyk in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-22-2010, 04:46 PM
  5. Button Text Gets Smaller When Button Clicked On
    By googlebot in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-06-2009, 02:37 PM
  6. Button Clicked
    By boylejob in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-22-2007, 06:33 PM
  7. [SOLVED] Do until button clicked
    By kaiser in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-31-2005, 08:05 AM

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