ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help With Simple Combobox Programming (https://www.excelbanter.com/excel-programming/275419-help-simple-combobox-programming.html)

MAB[_3_]

Help With Simple Combobox Programming
 
I have a combo box on sheet1. When the user clicks on the combo box the
first time ( it gets focus ) It should add/load all items from sheet2 column
A. Now when the user selects from the combobox that item should be
copied/placed on sheet1.A5 similarly the next item selected in the combo box
should be placed below A6 and so on

How can this be accomplished with code

thx




Jean-Paul Viel

Help With Simple Combobox Programming
 
Hi,



Use code like that :





Private Sub cboIn_Click()

Dim intR As Integer

intR = Range("a4").CurrentRegion.Rows.Count

Range("a4").Offset(intR, 0).Value = cboIn.Value

End Sub



Private Sub cboIn_GotFocus()

Dim rg As Range

cboIn.Clear

For Each rg In Worksheets("sheet4").Range("a1").CurrentRegion

cboIn.AddItem rg.Text

Next rg

End Sub




--
JP

http://www.solutionsvba.com


"MAB" wrote in message
...
I have a combo box on sheet1. When the user clicks on the combo box the
first time ( it gets focus ) It should add/load all items from sheet2

column
A. Now when the user selects from the combobox that item should be
copied/placed on sheet1.A5 similarly the next item selected in the combo

box
should be placed below A6 and so on

How can this be accomplished with code

thx







All times are GMT +1. The time now is 07:23 PM.

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