+ Reply to Thread
Results 1 to 8 of 8

Populate a cell with a value simply by clicking on it

  1. #1
    Registered User
    Join Date
    07-20-2011
    Location
    Phoenix, AZ
    MS-Off Ver
    Excel 2003
    Posts
    7

    Populate a cell with a value simply by clicking on it

    Hello!

    I am creating an evaluation document. Each area has several traits that I look at. Each trait can be given a 4 (Highly Effective) to 1 (Ineffective) grade. Each grade has its own column, so instead of putting an "x" under the score for each trait or writing a 4, 3, 2, or 1 under each grade, I would like to click on the cell and have that score appear. I have attached a copy of the document with the company-specific information deleted.

    If you open the attachment, let's look at Trait 1 of Area 1 (row 12). I would like to click on G12 and have a "4" appear. If I then click on H12, I would like the cell to show "3" and the "4" in G12 to disappear. I would like this ability to be installed for each trait, and for Observation 1 (columns G-J) and Observation 2 (columns K-N) to not affect one another.

    Any help would be appreciated. Let me know if you need more information.
    Attached Files Attached Files

  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: Populate a cell with a value simply by clicking on it

    Do you want guidance on how to write the VBA, or are you asking someone to write it for you? The approach would be to use the Worksheet_SelectionChange event to detect when the cursor enters one of the cells of interest. However, this event can only detect when the selection changes, not when the cell is clicked. That is, if you move the cursor with arrow keys it will do the same things as if you click the cell.

    Also, it would be worthwhile to consider a design with a single column that has 1-4 rather than each number in its own column. Any particular reason you want separate columns?
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Valued Forum Contributor
    Join Date
    09-01-2013
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010
    Posts
    324

    Re: Populate a cell with a value simply by clicking on it

    Try this.

    Right click the Tab of your worksheet (Individual) > CLick View Code and paste the code below in the VBA window.

    Each cell that you right click will be updated with the value from the header row. I would lock all cells you don't want changing if you accidentally right click it as I see some are locked already.

    Please Login or Register  to view this content.
    Last edited by playaller; 05-14-2014 at 05:10 PM. Reason: Added notes to code


    Shelton A.
    If Helpful, Add Reputaion!

  4. #4
    Registered User
    Join Date
    07-20-2011
    Location
    Phoenix, AZ
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Populate a cell with a value simply by clicking on it

    I have no idea how to write VBA. I just recently learned that you have to run a macro to enable the VBA.

  5. #5
    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: Populate a cell with a value simply by clicking on it

    You have provided a file, but is that exactly what your final file will look like? That is:

    How many observations will you have?
    How many Areas will you have?
    How many Traits will each Area have?

    Are any of the above variable? That is, could they change over time?

    Will Areas and Traits have actual names instead of labels like Area 1 and Trait 2?

  6. #6
    Valued Forum Contributor
    Join Date
    09-01-2013
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010
    Posts
    324

    Re: Populate a cell with a value simply by clicking on it

    Hello jvp123,

    Your file is attached with the code implemented. Just download it > open it > and right click in the cells to update the number. Let me know how it goes.

    Your file is attached below:
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    07-20-2011
    Location
    Phoenix, AZ
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Populate a cell with a value simply by clicking on it

    Worked perfect. Thanks playaller!

  8. #8
    Valued Forum Contributor
    Join Date
    09-01-2013
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010
    Posts
    324

    Re: Populate a cell with a value simply by clicking on it

    You're more than welcome! Glad I could help. Feel free to mark the thread as resolved if so! Thanks 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. Populate the range of data in Userform by clicking on cell value which is related
    By haridevadiga in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-28-2013, 02:31 AM
  2. Replies: 1
    Last Post: 02-07-2012, 07:09 AM
  3. Populate dropDown in a custom ribbon on clicking a button
    By johnjacobt in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-01-2011, 05:02 AM
  4. how to change cell colour by simply clicking on it
    By lovebunny in forum Excel General
    Replies: 9
    Last Post: 08-10-2006, 02:50 PM
  5. VBA programming: Simply trying to select cell-- or not so simply?
    By whiteliyl_111 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-10-2005, 01:18 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