Combobox multiple cell cange???

friso

New Member
Joined
Apr 1, 2002
Messages
25
Hello,

Lets say i have a combobox on 'Sheet1'!B2
which lists the values in range 'Sheet2'A1:
'Sheet2'!A50.

Sheet 2 looks someting like this<table><tr><td>Name</td><td>Company</td><td>Number</td><td>Account</td></tr><tr><td>Fred</td><td>fredscomp</td><td>12345</td><td>128</td></tr></table>

the user can select the combobox on sheet1. In this case this would be fred.

Now comes the question:

How can i make excel (when fred is selected) to copy the cells 'Sheet2'!A2:'Sheet2'!D2
to 'Sheet1'!C2:'Sheet1'!F2 ????

Thus what i want to know is how to copy a range of cells when a certain item in the listbox is selected.

Anyone that has excel wisdom enough to break this problem?

Thanks.
This message was edited by friso on 2002-04-04 07:07
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Yep, put this in your Combobox change event:

application.screenupdating=false
If ComboBox1.Value = "Fred" Then
Worksheets("sheet2").Range("a2:d2").Cut
Worksheets("sheet1").Range ("c2:f2").Select
ActiveSheet.Paste
End If
application.screenupdating=true

End Sub

There's probably an easier way as well but I am very, very drunk
 
Upvote 0
Thanks,

However i have a randge of 50 items in the listbox which names are not known in advance.
 
Upvote 0
Try the following:

Make Sheet1!C2 the linked cell to the combobox and make the input range Sheet2!A1:A50. Then in cell Sheet1!D2 put the following formula: =VLOOKUP(Sheet1!$C$2,Sheet2!$A$1:$D$50,2,FALSE)

Then in cell Sheet1!E2 put the following formula: =VLOOKUP(Sheet1!$C$2,Sheet2!$A$1:$D$50,3,FALSE)

Then in cell Sheet1!F2 put the following formula: =VLOOKUP(Sheet1!$C$2,Sheet2!$A$1:$D$50,4,FALSE)
 
Upvote 0
Hi Al,

The function gives an error..any suggestions. With error i mean excel does not accept the statement at all.

thanks
 
Upvote 0
Al this code is accepted but it gives an #NA
in cellD2:
=VLOOKUP(C2;'Sheet2'!A2:A50;2;FALSE)
 
Upvote 0
sorry i meant i put this code in:


=VLOOKUP(C2;'Sheet2'!A2:D50;2;FALSE)

still get an #NA though
 
Upvote 0
Make sure that C2 is the comboboxes linked cell. Go into design mode and right click on the combobox. Fill in C2 in the LinkedCell field.
 
Upvote 0
it is the linked cell, still nothing i'm affraid. Value of C2 = 1 (which i selected of course.
 
Upvote 0
try using =INDEX(Sheet2!A2:D50,C2,1) in D2 instead of VLOOKUP, does that help?
 
Upvote 0

Forum statistics

Threads
1,213,567
Messages
6,114,342
Members
448,570
Latest member
rik81h

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top