combobox positiion

S

sunilpatel

Cell a1 contains a value indicating a particular row. I wish my combobox to
appear on that row in column "b" using vba.

Sunil
 
R

Rick Rothstein

Assuming you got your ComboBox from the Control Toolbox toolbar and that its
name is ComboBox1, use this worksheet Change event code...

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(0, 0) = "A1" Then
With ActiveSheet
.OLEObjects("ComboBox1").Left = .Columns("B").Left
.OLEObjects("ComboBox1").Top = .Rows(Range("A1").Value).Top
End With
End If
End Sub

Just enter a number in A1 and the ComboBox should move to the correct row.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top