Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Before Double Click Event
Hi all,
I have a BeforeDoubleClick on a worksheet that activates a user form for entering data on to a sheet. What I want is for the value of the cell that I double clicked to be entered in to a Combo Box (ComboBox1) on my userform. If it is possible to write a code for this I would greatly appreciate some help with the code. Regards gregork |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Before Double Click Event
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean) Dim frm As UserForm1 Set frm = New UserForm1 frm.ComboBox1.AddItem Target.Value frm.Show Set frm = Nothing End Sub -- Rob van Gelder - http://www.vangelder.co.nz/excel "gregork" wrote in message ... Hi all, I have a BeforeDoubleClick on a worksheet that activates a user form for entering data on to a sheet. What I want is for the value of the cell that I double clicked to be entered in to a Combo Box (ComboBox1) on my userform. If it is possible to write a code for this I would greatly appreciate some help with the code. Regards gregork |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Before Double Click Event
Many thanks for the reply Rob. I pasted the code in to my worksheet event
and the userform shows when I double click but the cell value is not transposed in to combobox1. Any idea where I might be going wrong on this one? Kind Regards gregork p.s -are you a kiwi? "gregork" wrote in message ... Hi all, I have a BeforeDoubleClick on a worksheet that activates a user form for entering data on to a sheet. What I want is for the value of the cell that I double clicked to be entered in to a Combo Box (ComboBox1) on my userform. If it is possible to write a code for this I would greatly appreciate some help with the code. Regards gregork |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Before Double Click Event
It may not be immediately visible until you use the Combo dropdown.
This can be tweaked by doing something with the ListIndex property. Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) Dim frm As UserForm1 Set frm = New UserForm1 frm.ComboBox1.AddItem Target.Value With frm.ComboBox1: .ListIndex = .ListCount - 1: End With frm.Show Set frm = Nothing End Sub Another possibility is that you've got a ControlSource properties set. The steps I went through: 1. New Workbook 2. Copy the event code to Sheet1 3. New UserForm (UserForm1) 4. New ComboBox on UserForm1 (ComboBox1) 5. Put some data into a cell, then doubleclick it. Yep, I'm a Kiwi! Living in Whangarei (at least, just outside Whangarei) -- Rob van Gelder - http://www.vangelder.co.nz/excel "gregork" wrote in message ... Many thanks for the reply Rob. I pasted the code in to my worksheet event and the userform shows when I double click but the cell value is not transposed in to combobox1. Any idea where I might be going wrong on this one? Kind Regards gregork p.s -are you a kiwi? "gregork" wrote in message ... Hi all, I have a BeforeDoubleClick on a worksheet that activates a user form for entering data on to a sheet. What I want is for the value of the cell that I double clicked to be entered in to a Combo Box (ComboBox1) on my userform. If it is possible to write a code for this I would greatly appreciate some help with the code. Regards gregork |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Before Double Click Event
Thanks heaps Rob, the new code works perfectly. Good to know I can tap in to
some good old 'Kiwi ingenuity' on this newsgroup when I need it ;-) Kind Regards gregork "Rob van Gelder" wrote in message ... It may not be immediately visible until you use the Combo dropdown. This can be tweaked by doing something with the ListIndex property. Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) Dim frm As UserForm1 Set frm = New UserForm1 frm.ComboBox1.AddItem Target.Value With frm.ComboBox1: .ListIndex = .ListCount - 1: End With frm.Show Set frm = Nothing End Sub Another possibility is that you've got a ControlSource properties set. The steps I went through: 1. New Workbook 2. Copy the event code to Sheet1 3. New UserForm (UserForm1) 4. New ComboBox on UserForm1 (ComboBox1) 5. Put some data into a cell, then doubleclick it. Yep, I'm a Kiwi! Living in Whangarei (at least, just outside Whangarei) -- Rob van Gelder - http://www.vangelder.co.nz/excel "gregork" wrote in message ... Many thanks for the reply Rob. I pasted the code in to my worksheet event and the userform shows when I double click but the cell value is not transposed in to combobox1. Any idea where I might be going wrong on this one? Kind Regards gregork p.s -are you a kiwi? "gregork" wrote in message ... Hi all, I have a BeforeDoubleClick on a worksheet that activates a user form for entering data on to a sheet. What I want is for the value of the cell that I double clicked to be entered in to a Combo Box (ComboBox1) on my userform. If it is possible to write a code for this I would greatly appreciate some help with the code. Regards gregork |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to use selection change instead of double click event? | Excel Discussion (Misc queries) | |||
How to change syperlink from single click to double click | Excel Worksheet Functions | |||
Is there a double click event for cell? | Excel Discussion (Misc queries) | |||
Click on graph bar to execute a double-click in a pivot table cell | Charts and Charting in Excel | |||
Click Event | Excel Programming |