ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   combobox on sheet (https://www.excelbanter.com/excel-programming/428257-combobox-sheet.html)

sunilpatel

combobox on sheet
 
My code ends as follows.

Range(Cells(1, 2)).Select ' cell on which
combobox is positioned
ActiveCombo.AddItem "'Free Type' Entry"
ActiveSheet.ComboNAME.DropDown
End

if i move mouse over items in list, they are selected, but if i use arrow
keys the cell selection moves
What i need is for the arrow key to work when combobox is dropped down and
activecell to move when combobox is close.

Can someone help please






OssieMac

combobox on sheet
 
The reason that moving the cursor changes the cell is because the cell is
active not the combo box. when you click in the combo box then the combo
becomes active.

If you want the combo box to drop down try using the GotFocus event as below
then when the user clicks in the combo it will automatically dropdown and you
can use the arrows or the mouse to select.

If you want a specific cell selected after you have made the combo box
selection then you can use the combo change event or maybe lostfocus.

Private Sub ComboName_GotFocus()
ComboName.DropDown
End Sub


Private Sub ComboName_Change()
Cells(1, 2).Select
End Sub

--
Regards,

OssieMac


"sunilpatel" wrote:

My code ends as follows.

Range(Cells(1, 2)).Select ' cell on which
combobox is positioned
ActiveCombo.AddItem "'Free Type' Entry"
ActiveSheet.ComboNAME.DropDown
End

if i move mouse over items in list, they are selected, but if i use arrow
keys the cell selection moves
What i need is for the arrow key to work when combobox is dropped down and
activecell to move when combobox is close.

Can someone help please








All times are GMT +1. The time now is 03:58 AM.

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