ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How to make a table with only one cell to be selected? (https://www.excelbanter.com/excel-discussion-misc-queries/134689-re-how-make-table-only-one-cell-selected.html)

ghnogueira

How to make a table with only one cell to be selected?
 
Is there a way to make the selection be chosen by a mouse click instead of
typing?

Something like clicking on a desired cell makes it appear the X and
therefore select it just like if I had typed the X and hit enter.

Thanks :)

"vezerid" wrote:

You can use the following VBA event procedure for this:

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A2:B13")) Is Nothing Then
v = Target.Value
col = Target.Column
Application.EnableEvents = False
Range(ActiveSheet.Cells(2, col), ActiveSheet.Cells(13,
col)).ClearContents
Target.Value = v
Application.EnableEvents = True
End If
End Sub

To install: Right click on the sheet tab. Choose View Code... This
takes you to the VBA IDE.
Paste the above code in the window. It should operate like you want
from this point on.

HTH
Kostis Vezerides

On Mar 13, 7:24 pm, ghnogueira
wrote:
I know the title is kinda confusing, but I couldn't really think how to
explain in short words what I want.

I have these 2 column ranges (A2:A13 and B2:B13), and I want them to some
kind of selection boxes, where I can type something like an "X" to show
selection. But I want Excel to accept only ONE X per column, like if it was a
HTTP radio box, where you have like 5 different options, but can only choose
1 of them.

e.g.: when I type "x" on cell A3, and type again on cell A7, it
automatically deletes the x on cell A3, or something like that. It may not be
an "x", might be something else. But that's the idea.

Was it clear enough?






All times are GMT +1. The time now is 08:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com