Page 1
Page 1
Started By
Message

Excel VBA Help - Range of data populating a sheet depending on which listbox case you pick

Posted on 9/27/18 at 3:26 pm
Posted by VermilionTiger
Member since Dec 2012
38253 posts
Posted on 9/27/18 at 3:26 pm
So I have a list of vendors, lets say Vendor 1, Vendor 2, Vendor 3. The vendors with description, pricing, and part numbers are on sheet 2. I want sheet 1 to contain a listbox that will make things a little easier to sort through. By selecting the listbox case (or selection), it will only populate data (on sheet 1) of the vendor I selected.

Vendor 1 has data throughout the range of A1:P12.
Vendor 2 has data throughout the range of A13:P26
etc..You get my point here..

My problem is that when doing a select case argument, it is throwing back errors when I type this code in:

quote:


Select Case listbox1.listindex

Case 0

sheet1.range("A1:P12").value = Sheet2.range("A1:P12")

Case 1

sheet1.range("A13:P26").value = Sheet2.range("A13:P26")

End Select

End Sub




Any help is appreciated. It appears that calling out a range of multiple cells this way is not correct.
This post was edited on 9/27/18 at 3:32 pm
Posted by LSUnation78
Northshore
Member since Aug 2012
13407 posts
Posted on 9/28/18 at 2:05 am to
A little drunk and not sure I follow completely. But if I understand what you are trying to do right...

I would probably setup each vendor on its own hidden tab. Then I'd nest IF statements for what to do if each drop down selection is taken ='ThatParticularVendor' have have it pull each value per that vendor tab.

As always, lots of ways to get things done in excel. More of a matter which you are more familar/comfortable doing.
first pageprev pagePage 1 of 1Next pagelast page
refresh

Back to top
logoFollow TigerDroppings for LSU Football News
Follow us on X, Facebook and Instagram to get the latest updates on LSU Football and Recruiting.

FacebookXInstagram