Problems with Combobox

M

MBais

Hi

My problem is when i try to cut and paste a combobox from one sheet t
another.

The thing is that i first update the combobox by the addItem function
then i cut the combobox and paste it in another worksheet. But when
paste it all the added items are lost. I have also tried to copy th
combobox to another worksheet, and everything seems fine with th
original combobox containing all the added items. This is the cod
sequence:

"an addItem loop adding the elements" then
ComboBox1.Cut
Workbooks("The workbook").Sheets("The sheet").Activate
ActiveSheet.Range("The Range").Select
ActiveSheet.Paste

What seems a bit strange to me, is when I manually with th
ListFillRange in properties add items to the combobox and cut/paste th
combobox everything goes just fine.

All help, is good hel
 
M

MBais

Well, it might work to copy all code to another sheet. But in this case
it's not a very good idea im afraid. My program has become quite
complex. But if someone knows how to call a code sequence only once
when a combobox is selected, i think the problem will be solved. I've
tried subs as Combobox1_Click and
Combobox1_GotFocus, but they're called every single time the combobox
is "used".
 
O

okaizawa

Hi,

i don't know how to copy items added by AddItem with a combobox
at a time. but i suppose the following can copy items,

Dim varList As Variant
varList = ComboBox1.List
ComboBox1.Cut
Workbooks("The workbook").Sheets("The sheet").Activate
ActiveSheet.Range("The Range").Select
ActiveSheet.Paste
Selection.Object.List = varList

when i copy a combobox, the added items are lost always
whether by macro or manual operation. and they are not saved
in a workbook file. (Excel2000)
 

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

Populate combobox 6
Cut and paste with a combobox 0
Combobox 3
Cut/Copy Combobox - I can't update 2
Rename combobox with a macro 1
ComboBox Queries 2
Userform Combobox 7
Combobox add large range of cells 1

Top