Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi all, I have 3 checkbox in sheet and i have 3 range name x, y and z. what i want is, when i *select any cell in x range checkbox1.value=true *is run, when i *select any cell in y range checkbox2.value=true *is run, when i *select any cell in z range checkbox3.value=true * is run. what is the code for this operations? thanks..... -- up2you ------------------------------------------------------------------------ up2you's Profile: http://www.excelforum.com/member.php...o&userid=33468 View this thread: http://www.excelforum.com/showthread...hreadid=532691 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
With your 3 ranges named "sel_X", "sel_Y" and "sel_Z",
paste following code in worksheet's code: '----------- Private Sub Worksheet_SelectionChange(ByVal Target As Range) CheckBox1.Value = _ Not Intersect(Range("sel_X"), Target) Is Nothing CheckBox2.Value = _ Not Intersect(Range("sel_Y"), Target) Is Nothing CheckBox3.Value = _ Not Intersect(Range("sel_Z"), Target) Is Nothing End Sub '------------------ HTH -- AP "up2you" a écrit dans le message de ... Hi all, I have 3 checkbox in sheet and i have 3 range name x, y and z. what i want is, when i *select any cell in x range checkbox1.value=true *is run, when i *select any cell in y range checkbox2.value=true *is run, when i *select any cell in z range checkbox3.value=true * is run. what is the code for this operations? thanks..... -- up2you ------------------------------------------------------------------------ up2you's Profile: http://www.excelforum.com/member.php...o&userid=33468 View this thread: http://www.excelforum.com/showthread...hreadid=532691 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() To snag a snippet of code from he http://www.cpearson.com/excel/named.htm You can do this: Code: -------------------- Function NameOfParentRange(Rng As Range) As String Dim Nm As Name For Each Nm In ThisWorkbook.Names If Rng.Parent.Name = Nm.RefersToRange.Parent.Name Then If Not Application.Intersect(Rng, Nm.RefersToRange) Is Nothing Then NameOfParentRange = Nm.Name Exit Function End If End If Next Nm NameOfParentRange = "" End Function Private Sub Worksheet_SelectionChange(ByVal Target As Range) Cells(1, 1).Value = NameOfParentRange(Target) End Sub -------------------- Change it to set the value of your checkboxes instead of the cell(1,1)'s value. -- cm_gmail ------------------------------------------------------------------------ cm_gmail's Profile: http://www.excelforum.com/member.php...o&userid=33451 View this thread: http://www.excelforum.com/showthread...hreadid=532691 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() To snag a snippet of code from he http://www.cpearson.com/excel/named.htm You can do this: Code: -------------------- Function NameOfParentRange(Rng As Range) As String Dim Nm As Name For Each Nm In ThisWorkbook.Names If Rng.Parent.Name = Nm.RefersToRange.Parent.Name Then If Not Application.Intersect(Rng, Nm.RefersToRange) Is Nothing Then NameOfParentRange = Nm.Name Exit Function End If End If Next Nm NameOfParentRange = "" End Function Private Sub Worksheet_SelectionChange(ByVal Target As Range) Cells(1, 1).Value = NameOfParentRange(Target) End Sub -------------------- Change it to set the value of your checkboxes instead of the cell(1,1)'s value. -- cm_gmail ------------------------------------------------------------------------ cm_gmail's Profile: http://www.excelforum.com/member.php...o&userid=33451 View this thread: http://www.excelforum.com/showthread...hreadid=532691 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() hi again all, that's great. you are perfect consultants. See all again... -- up2you ------------------------------------------------------------------------ up2you's Profile: http://www.excelforum.com/member.php...o&userid=33468 View this thread: http://www.excelforum.com/showthread...hreadid=532691 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
'Autofill' macro for range of checkbox cell links | Excel Discussion (Misc queries) | |||
Cannot select checkbox to delete it from a spreadsheet | Excel Discussion (Misc queries) | |||
How can I select one checkbox and have it unselect other ones? | Excel Worksheet Functions | |||
Select checkbox with tab key? | Excel Programming | |||
select last cell in used range | Excel Programming |