ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Forms ComboBox (https://www.excelbanter.com/excel-programming/359351-forms-combobox.html)

cmpcwil2[_8_]

Forms ComboBox
 

Hi, I know how to find the cell address of a given vb combobox and the
set the offset....
ActiveSheet.OLEObjects("combobox 1").TopLeftCell.Offset(0, 1 + i)

But how do you do this for a form ComboBox?
I have tried declaring a combobox object but there is no TopLeftCell
do you have to use the linked cell property and then change th
activecell property?

Thank

--
cmpcwil
-----------------------------------------------------------------------
cmpcwil2's Profile: http://www.excelforum.com/member.php...fo&userid=3341
View this thread: http://www.excelforum.com/showthread.php?threadid=53446


Dave Peterson

Forms ComboBox
 
This worked ok for me:

Dim myDD As DropDown
Set myDD = ActiveSheet.DropDowns("Drop Down 1")
MsgBox myDD.TopLeftCell.Address

cmpcwil2 wrote:

Hi, I know how to find the cell address of a given vb combobox and then
set the offset....
ActiveSheet.OLEObjects("combobox 1").TopLeftCell.Offset(0, 1 + i)

But how do you do this for a form ComboBox?
I have tried declaring a combobox object but there is no TopLeftCell,
do you have to use the linked cell property and then change the
activecell property?

Thanks

--
cmpcwil2
------------------------------------------------------------------------
cmpcwil2's Profile: http://www.excelforum.com/member.php...o&userid=33411
View this thread: http://www.excelforum.com/showthread...hreadid=534463


--

Dave Peterson

cmpcwil2[_9_]

Forms ComboBox
 

Hi, thanks for the reply but it doesn't work for me.
I get the following error:
unable to get the DropDowns property of the worksheet class

Also when I try and replace DropDown with ComboBox I get the following
error:
object doesn't support this property or method.


--
cmpcwil2
------------------------------------------------------------------------
cmpcwil2's Profile: http://www.excelforum.com/member.php...o&userid=33411
View this thread: http://www.excelforum.com/showthread...hreadid=534463


cmpcwil2[_10_]

Forms ComboBox
 

Hi,
The following works..
Dim myDD As DropDown
Set myDD = ActiveSheet.DropDowns(Application.Caller)
MsgBox myDD.TopLeftCell.Address

Thanks for the help


--
cmpcwil2
------------------------------------------------------------------------
cmpcwil2's Profile: http://www.excelforum.com/member.php...o&userid=33411
View this thread: http://www.excelforum.com/showthread...hreadid=534463


Dave Peterson

Forms ComboBox
 
I would bet that the dropdown isn't named "drop down 1".

If you select it and look in the name box (to the left of the formula bar),
you'll see the name.



cmpcwil2 wrote:

Hi, thanks for the reply but it doesn't work for me.
I get the following error:
unable to get the DropDowns property of the worksheet class

Also when I try and replace DropDown with ComboBox I get the following
error:
object doesn't support this property or method.

--
cmpcwil2
------------------------------------------------------------------------
cmpcwil2's Profile: http://www.excelforum.com/member.php...o&userid=33411
View this thread: http://www.excelforum.com/showthread...hreadid=534463


--

Dave Peterson

Dave Peterson

Forms ComboBox
 
This'll work depending on how the code is called.

cmpcwil2 wrote:

Hi,
The following works..
Dim myDD As DropDown
Set myDD = ActiveSheet.DropDowns(Application.Caller)
MsgBox myDD.TopLeftCell.Address

Thanks for the help

--
cmpcwil2
------------------------------------------------------------------------
cmpcwil2's Profile: http://www.excelforum.com/member.php...o&userid=33411
View this thread: http://www.excelforum.com/showthread...hreadid=534463


--

Dave Peterson


All times are GMT +1. The time now is 11:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com