PDA

View Full Version : Solved: I'm stumped ....please help



Killer Bud
05-13-2010, 09:54 AM
Being that I am new to VBA I may not be doing this right....but here is what I'm doing.

I have created a userform with 2 combo boxes and some text boxes. The combo boxes get their data from the properties row source on sheet 1. Combo box 1 text goes to cell A20, Combo Box 2 text goes to cell A25.

I have made a table that has the combo box 1 data down column A and combo box 2 data across row 46. I then created a VLOOKUP to lookup A20 ( combo box 1 ) and match A25 ( combo box 2 ). This works flawlessly on the sheet. When I go to my userform which contains the textbox that I want to show this VLOOKUP value, ( which I am trying to show by using control source of I20 in the properties) , the VLOOKUP stops working and the formula disappears...??

Does this make any sense? The funny thing is that I can change combo box 1 and 2 a few times and it works ( as in the textbox shows the value in I20), but then it stops working. It doesn't give an error, it just keeps whatever value found and does not show the VLOOKUP formula any longer in the cell.

Is there another way to get a value from a cell into a text box on a userform?

Sorry if this is an easy fix, like I said....I'm pretty green to VB

Bob Phillips
05-13-2010, 10:17 AM
Post the code, we are guessing otherwise. Better still, post the whole workbook.

Killer Bud
05-13-2010, 10:37 AM
Here is my workbook. I realize I have data is missing from my tables....but I really want to get this to work before I input all of the data.

Thanks,

Aussiebear
05-13-2010, 03:00 PM
Change this
Private Sub ComboBox2_Change()
Range("a20") = ComboBox2.Text
End Sub
to this
Private Sub ComboBox2_Change()
Range("a20").Value = ComboBox2.Text
End Sub And similarly change this
Private Sub ComboBox3_Change()
Range("a25") = ComboBox3.Text
End Sub to this
Private Sub ComboBox3_Change()
Range("a25").Value = ComboBox3.Text
End Sub

Killer Bud
05-13-2010, 03:25 PM
Thanks, works like a charm now.