Cut/Copy Combobox - I can't update

M

MBais

I want to cut a combobox in one sheet, and then paste it in another.
Then i want to update the combobox with ListFillRange,Top and Left. My
problem is that i can't update the combobox after i've pasted it. I've
tried the following code-excample:

ComboBox1.Cut
Sheets(2).Select
ActiveSheet.PasteSpecial Format:="Microsoft Forms 2.0 ComboBox Object",
Link _
:=False, DisplayAsIcon:=False
ComboBox1.ListFillRange = "A1:B2"
ComboBox1.Top = 10
.....

Any help - is good help!
 
M

moi

When I try this:

Public Sub MoveCombo()
Dim wb As Workbook
Dim ws1, ws2 As Worksheet
Set wb = ThisWorkbook
Set ws1 = wb.Sheets("Sheet1")
Set ws2 = wb.Sheets("Sheet2")
ws1.Activate
ws1.ComboBox1.Select
Selection.Cut
ws2.Activate
ActiveSheet.Paste
ws2.OLEObjects(1).ListFillRange = "A1:B2"
End Sub


it seems to work. Only I can't get two columns in 1 Combo, so maybe A1:A2 or
B1:B2 would be better.
 
M

moi

....or set ColumnCount to 2 :-$


moi said:
When I try this:

Public Sub MoveCombo()
Dim wb As Workbook
Dim ws1, ws2 As Worksheet
Set wb = ThisWorkbook
Set ws1 = wb.Sheets("Sheet1")
Set ws2 = wb.Sheets("Sheet2")
ws1.Activate
ws1.ComboBox1.Select
Selection.Cut
ws2.Activate
ActiveSheet.Paste
ws2.OLEObjects(1).ListFillRange = "A1:B2"
End Sub


it seems to work. Only I can't get two columns in 1 Combo, so maybe A1:A2
or B1:B2 would be better.
 

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

Similar Threads

Combobox 3
Add Item To ActiveX ComboBox 17
Problems with Combobox 3
refresh combobox 2
Cut and paste with a combobox 0
cancel a combobox change 1
combobox list range 16
Combo Source from another file 2

Top