click functions

  • Thread starter Thread starter jlong
  • Start date Start date
J

jlong

I have a range of 20 possible measurments that correspond to 20 items,
have made a table and want to set it up so that the user has to clic
the cell (or check box) that corresponds to the items measurment. onl
1 out of the 20 possible can selected at a time for each item and th
checked cell must make that cell = "X" or true. Please help??
 
Try using a column for the checkboxes, and some code like this to put a tick
in the cell
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

With Target
If .Column = 1 Then
.EntireColumn.Clear
If .Value = "a" Then
.Value = ""
.Font.Name = "Arial"
.Offset(0, 1).Value = ""
Else
.Value = "a"
.Font.Name = "Marlett"
End If
End If
End With
End Sub


'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
I can't seem to get that to work, my range of cells are C3:V23 in whic
only one checkbox of each column can be selected. The cells in eac
column that contain the checked boxes are to get a value of "x" and th
rest must be empty.
This seems like it should be easy but it's not working for me
 
If you allow row m2 for your checkmarks, use this code variation. To check a
column, just select any of C2:V2

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Not Intersect(Target, Range("C2:V2")) Then
With Target
Range("C2:V2").Clear
If .Value = "a" Then
.Value = ""
.Font.Name = "Arial"
.Offset(0, 1).Value = ""
Else
.Value = "a"
.Font.Name = "Marlett"
End If
End If
End With
End Sub


'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top