Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default when select cell in range checkbox value is true_but how?


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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 718
Default when select cell in range checkbox value is true_but how?

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default when select cell in range checkbox value is true_but how?


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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default when select cell in range checkbox value is true_but how?


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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default when select cell in range checkbox value is true_but how?


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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
'Autofill' macro for range of checkbox cell links [email protected] Excel Discussion (Misc queries) 1 December 5th 06 02:44 PM
Cannot select checkbox to delete it from a spreadsheet Roundy Excel Discussion (Misc queries) 3 November 30th 05 02:38 PM
How can I select one checkbox and have it unselect other ones? Jake Excel Worksheet Functions 1 October 10th 05 03:39 AM
Select checkbox with tab key? BrianG[_4_] Excel Programming 8 June 12th 04 03:30 PM
select last cell in used range Tony P Excel Programming 1 January 7th 04 06:41 AM


All times are GMT +1. The time now is 10:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"