help with VBA

V

vai

Hi, the following attachment is my workbook on which i am working on
The code which i have written is not giving the output which i want an
it is printing 0. I know for a list of variables to be entered in th
listbox i should use some other function other than VLookup. But i don'
know which one i should use so that it gives me the variables accordin
to the table name which i have mentioned in the drop down box. I hop
you could help me with that

+-------------------------------------------------------------------
|Filename: book2.zip
|Download: http://www.excelbanter.com/attachment.php?attachmentid=307
+-------------------------------------------------------------------
 
V

Vacuum Sealed

Hi, the following attachment is my workbook on which i am working on.
The code which i have written is not giving the output which i want and
it is printing 0. I know for a list of variables to be entered in the
listbox i should use some other function other than VLookup. But i don't
know which one i should use so that it gives me the variables according
to the table name which i have mentioned in the drop down box. I hope
you could help me with that.


+-------------------------------------------------------------------+
|Filename: book2.zip |
|Download: http://www.excelbanter.com/attachment.php?attachmentid=307|
+-------------------------------------------------------------------+
Hi

Don't mean to burst your bubble but there is no code attached to this
Workbook.

How are we going to ascertain where to fault is if there is no code to
scrutinise...

Mick.
 
D

Don Guillett

Hi, the following attachment is my workbook on which i am working on.
The code which i have written is not giving the output which i want and
it is printing 0. I know for a list of variables to be entered in the
listbox i should use some other function other than VLookup. But i don't
know which one i should use so that it gives me the variables according
to the table name which i have mentioned in the drop down box. I hope
you could help me with that.


+-------------------------------------------------------------------+
|Filename: book2.zip |
|Download: http://www.excelbanter.com/attachment.php?attachmentid=307|
+-------------------------------------------------------------------+

I don't often work with userforms as I like to KISS. However,try this
Private Sub ComboBox1_Change()

Dim i As Integer
Dim lastrow As String
Dim Value As String
'Dim Data As String
'Dim val As String
With Worksheets("Sheet1")
Value = Me.ComboBox1.Value
lastrow = .Cells(Rows.Count, "B").End(xlUp).Row
'val = Application.VLookup(Value, Range("A:B"), 2, False)
ListBox1.AddItem Application.VLookup(Value, Range("A:B"), 2, False)
End With
End Sub
 

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