LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Insert combo box in a cell

Add a combobox from the control toolbox toolbar to your worksheet--set it up
exactly the way you like it. Set the .style, .listfillrange, all that stuff.

Then you can use a worksheet_selectionchange event to move it close to your
selected cell.

Then rightclick on the worksheet tab and select view code. Paste this into the
code window.

Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Me.ComboBox1.Visible = False
With Target
If .Cells.Count 1 Then Exit Sub
If Intersect(.Cells, Me.Range("b:b")) Is Nothing Then Exit Sub

Me.ComboBox1.LinkedCell = .Address(external:=True)
With .Offset(0, 1)
Me.ComboBox1.Top = .Top
Me.ComboBox1.Left = .Left
End With
Me.ComboBox1.Visible = True
End With

End Sub

my combobox was named combobox1 and I showed it when I selected a single cell in
column B. And I showed it just to the right of that cell.


art wrote:

I want to add a combe box to a whole chart, each line should have a combo
box. How can I insert in the cell the combo box? I have a long list and I
need in each cell a combo box. It doesn't make sense to make in each cell
seperatly a combo. Isn't there an easier way?
Also how can I make, that after i pick an item from the combo box and press
enter, it should go to the next cell?
Please help.


--

Dave Peterson
 
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
How to insert a list in the ActiveX combo box Carl Snider New Users to Excel 1 February 8th 07 10:28 PM
Can I auto insert a worksheet when I insert a value in a cell. iainc Excel Worksheet Functions 0 April 27th 06 08:37 AM
How do I insert combo drop box and still be able to sort? Anne Jett Excel Worksheet Functions 1 August 9th 05 09:57 PM
Why can't I insert a Combo Box in Excel? mpatters Excel Discussion (Misc queries) 1 April 6th 05 11:07 PM
"Combo Box - getting control combo box to stick in place in worksh ajr Excel Discussion (Misc queries) 0 February 15th 05 07:45 PM


All times are GMT +1. The time now is 10:01 PM.

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"