Select only one from five choices

PCTech

Board Regular
Joined
Mar 24, 2005
Messages
215
I'm trying to find a way to make the user select only one of five columns in a row. What I’m trying to get is a ranking of 1 to 5. The user will click a cell and it will fill in or the user puts an X in it. In row 8 I want to select A through E but only one of them. If the user changes their mind and clicks another cell, the first cell clears. I hope you can understand what I'm trying to do.

Thanks
 
This is perfect.
I changed Target = "X" to Target = "P" and made the font Wingdings 2 so I now have a check mark in the cell.

Thanks for all the help.
 
Upvote 0

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Boller, will you tell me what the 6 is for in
Code:
Cells(Target.Row, 6).Select
I don't see where the 6th row or column is involved at all.
This went over so well that they now want changes. I'm trying to see if I can do this to one row at a time. Every other row will be for comments. I can make it work on row 8 OK but I can't get it to row 10 and 12 and so on.

Thanks
 
Upvote 0
The 6 is the Column (column F).
The selection automatically changes to column 6 if more than one cell is selected within A8:E28

To change the relevant cells, the cell references in this line need to be changed :-

Code:
If Not Intersect(Target, [A8:E28]) Is Nothing Then

Or perhaps :-

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, [A:E]) Is Nothing Then
    If Target.Cells.Count <> 1 Or Target.Row Mod 2 <> 0 Then
        MsgBox "Only one cell at a time in even numbered rows can be selected in columns A to E"
        Application.EnableEvents = False
        Cells(Target.Row, 6).Select
        Application.EnableEvents = True
    Else
        Cells(Target.Row, 1).Resize(, 5).ClearContents
        Target = "X"
    End If
End If
End Sub
 
Upvote 0
Correction :-

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.EnableEvents = False
If Not Intersect(Target, [A8:E28]) Is Nothing Then
    If Target.Cells.Count <> 1 Then
        MsgBox "Only one cell at a time can be selected in columns A to E"
        Cells(Target.Row, 6).Select
        GoTo e
    ElseIf Target.Row Mod 2 <> 1 Then
        Cells(Target.Row, 1).Resize(, 5).ClearContents
        Target = "X"
    End If
End If
e: Application.EnableEvents = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,813
Messages
6,121,706
Members
449,049
Latest member
THMarana

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top