+ Reply to Thread
Results 1 to 10 of 10

Help fix macro that is supposed to put a check in a certain column when a row is selected

  1. #1
    Registered User
    Join Date
    07-17-2020
    Location
    New York
    MS-Off Ver
    2020
    Posts
    24

    Help fix macro that is supposed to put a check in a certain column when a row is selected

    Hi,

    I got this code from a YouTube tutorial where if a row is clicked in a specific range, a checkmark will appear in a specific row. It works by putting a character in a column that has wingdings font and that character is a check. When I click in the range it puts the character in the cells in the range and not the specific column I want which is "AI". The code is on the sheet titled "Data Sheet".

    What I would like to happen:
    The user clicks on any row in the table, then that row is selected and it shows it is selected by displaying a checkmark in column AI at the end of the row. The range starts in row 5 and i want it to be able to go on for any amount of rows. So if 1000 rows are added, the user will be able to select that many rows. Then if the user clicks on the row again, it unselects. They can select multiple rows.

    Please help I know the code has to be adjusted I just do not know how! I am a beginner and appreciate this forum so far! Thanks

    Lexi
    Attached Files Attached Files

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Help fix macro that is supposed to put a check in a certain column when a row is selec

    Hi Lexi,

    Is this more what you are looking for?

    Please Login or Register  to view this content.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  3. #3
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Help fix macro that is supposed to put a check in a certain column when a row is selec

    Oh and if you DO want the Target.Offset(0,1).Select line enabled then you'll want to disable events otherwise the code will fire twice and you'll not get the behaviour you expect.

    It would be like this:

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    07-17-2020
    Location
    New York
    MS-Off Ver
    2020
    Posts
    24

    Re: Help fix macro that is supposed to put a check in a certain column when a row is selec

    Yes! you are wonderful thank you! But... would it be possible to allow the user to click on the same cell to un-select the row? This will be used by people other than my self so I am trying to turn it into something very user friendly.

  5. #5
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Help fix macro that is supposed to put a check in a certain column when a row is selec

    Hi Lexi,

    Clicking on the same cell a second time does not constitute a "selection change" and so this event will not fire in that case. There isn't a simple "mouse click event". I will have a look, I may be able to find a way to do this, but the code will certainly be much more complex than the method we are using now.

  6. #6
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Help fix macro that is supposed to put a check in a certain column when a row is selec

    We could use a double-click event if you are willing to make the user double-click to select instead of normal click?

    If that is a way to go, then replace the selection change macro with:

    Please Login or Register  to view this content.
    Last edited by Arkadi; 07-23-2020 at 12:19 PM.

  7. #7
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Help fix macro that is supposed to put a check in a certain column when a row is selec

    Arkadi said:
    Clicking on the same cell a second time does not constitute a "selection change"
    When using code like this, I put the focus on an adjoining cell. That is the purpose of the following line in the original code:
    Please Login or Register  to view this content.
    Enabling the above line, should eliminate the need for the 'Double Click' Event.

    Lewis

  8. #8
    Registered User
    Join Date
    07-17-2020
    Location
    New York
    MS-Off Ver
    2020
    Posts
    24

    Re: Help fix macro that is supposed to put a check in a certain column when a row is selec

    Hi,

    Thank you for your responses. I have tried the double click and it would not work for me. Also I enabled the Target.Offset(0,1).Select line and I recieved an error. But I decided to go for a different approach for simplicity. I want to keep the code how Arkadi had it in the first response. But can you make it so that it only selects the row if they click in column "AG"? I want the user to be able to enter information without the row being selected.

  9. #9
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Help fix macro that is supposed to put a check in a certain column when a row is selec

    How about:

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    07-17-2020
    Location
    New York
    MS-Off Ver
    2020
    Posts
    24

    Re: Help fix macro that is supposed to put a check in a certain column when a row is selec

    perfect thank you!

+ 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. Replies: 2
    Last Post: 03-20-2020, 11:15 AM
  2. [SOLVED] Macro to copy selected column to a reference column number
    By coolx72 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-01-2019, 05:48 PM
  3. [SOLVED] Macro attaching duplicate documents (and not supposed to!)
    By mattmickle in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-02-2015, 12:37 PM
  4. [SOLVED] Macro to find column with duplicates, for each of those check another column for duplicate
    By MaartenKoller in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-17-2013, 10:09 AM
  5. [SOLVED] Macros stop working, supposed to find next empty cell in column and label...
    By Axil in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-08-2012, 01:11 PM
  6. [SOLVED] how can I create a macro which will check the selected criteria in filter?
    By anand_erin in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 11-07-2012, 07:16 PM
  7. Run a Macro that will check if a drop down list selected is picked for each month
    By ltayala in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-10-2011, 04:19 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