+ Reply to Thread
Results 1 to 3 of 3

Populating a cell when another is clicked.

Hybrid View

  1. #1
    Registered User
    Join Date
    08-30-2012
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    1

    Populating a cell when another is clicked.

    Hello, got an excel question.

    Imagine I have 4 columns and 20 rows as a matrix of questions. Column E is a total.

    When I simply click cell A1 I'd like A5 to auto populate as the number 1. If I were to click C1 I'd like column E to populate as 3 instead.

    As I go down the sheet click either A,B,C or D (1,2,3 or 4) from each row, Column E shows the relevant number 1,2,3 or 4.

    Kind of like a multiple choice but with cell clicks as the choice part.

    Any ideas?

    Thanks

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Populating a cell when another is clicked.

    Hi, garethd,

    right-click Tab, choose View Code (code goes behind the sheet where event shall take place):

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Count > 1 Then Exit Sub
    If Not Intersect(Target, Range("A1:D20")) Is Nothing Then
      Cells(Target.Row, "E").Value = Target.Column
    End If
    End Sub
    Ciao,
    Holger

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Populating a cell when another is clicked.

    Hi,

    Does the attached help?
    Attached Files Attached Files
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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