Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
My question is- is there a way to replicate the feel of a checkbox
within an excel cell where one click on the cell sets the cell to a certain value , say "X", and another click on the cell sets it to a different value, say "" . I've received direction (below) on how to do this with a single column, but I need to do it with two noncontiguous columns (column C and H but not the columns in between) Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Intersect(Columns("B:B"), Target) Is Nothing Then Exit Sub If Target.Count 1 Then Exit Sub If Target.Value = "" Then Target.Value = "X" Else Target.Value = "" End If End Sub Any help would be appreciated. Thanks, Robert |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
If the code you have does what you want but only for a single range then you
can modify it a number of ways, here's a quick one: Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Intersect(Columns("B:B"), Target) Is Nothing Then If Intersect(Columns("D:D"), Target) Is Nothing Then Exit Sub End If If Target.Count 1 Then Exit Sub If Target.Value = "" Then Target.Value = "X" Else Target.Value = "" End If End Sub -- Cheers, Shane Devenshire "robnsd" wrote: My question is- is there a way to replicate the feel of a checkbox within an excel cell where one click on the cell sets the cell to a certain value , say "X", and another click on the cell sets it to a different value, say "" . I've received direction (below) on how to do this with a single column, but I need to do it with two noncontiguous columns (column C and H but not the columns in between) Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Intersect(Columns("B:B"), Target) Is Nothing Then Exit Sub If Target.Count 1 Then Exit Sub If Target.Value = "" Then Target.Value = "X" Else Target.Value = "" End If End Sub Any help would be appreciated. Thanks, Robert |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
On Feb 3, 2:37 pm, ShaneDevenshire
wrote: If the code you have does what you want but only for a single range then you can modify it a number of ways, here's a quick one: Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Intersect(Columns("B:B"), Target) Is Nothing Then If Intersect(Columns("D:D"), Target) Is Nothing Then Exit Sub End If If Target.Count 1 Then Exit Sub If Target.Value = "" Then Target.Value = "X" Else Target.Value = "" End If End Sub -- Cheers, Shane Devenshire "robnsd" wrote: My question is- is there a way to replicate the feel of a checkbox within an excel cell where one click on the cell sets the cell to a certain value , say "X", and another click on the cell sets it to a different value, say "" . I've received direction (below) on how to do this with a single column, but I need to do it with two noncontiguous columns (column C and H but not the columns in between) Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Intersect(Columns("B:B"), Target) Is Nothing Then Exit Sub If Target.Count 1 Then Exit Sub If Target.Value = "" Then Target.Value = "X" Else Target.Value = "" End If End Sub Any help would be appreciated. Thanks, Robert- Hide quoted text - - Show quoted text - Thanks for your help. That did the trick. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
checkbox gets value not sets value | Excel Discussion (Misc queries) | |||
Hiding a ComboBox with a Checkbox | Excel Worksheet Functions | |||
Checkbox functionality | Excel Discussion (Misc queries) | |||
Page printing and checkbox protection | Excel Discussion (Misc queries) | |||
copy many CHECKBOX | Excel Discussion (Misc queries) |