Phoenix_Turn
New Member
- Joined
- May 11, 2011
- Messages
- 37
Hi everyone! Need some help at the moment with some vba. The situation is: One column of my spreadsheet have some listed values like: cheese, pork, bread, soda in Column 'A' so cheese ("a2"), pork("a3"), bread ("a4") and soda ("a5")
Now, i have an input box in my userform, from there i need a loop structure so that the value entered in the textbook is assessed in column a to match that data, if not then, it is offset by 1 row, and the next column is assessed whether it has the same data as well and the procedure repeats until the data entered corrsponds to the data in the cell.
Once matched it is offset by 3 columns and in it will be the data i entered in the data table.
Here's what i got:
Set rngeg = Application.ActiveWorkbook.Worksheets("sheet3").Range("a2")
strFood = txteg.Text
rngeg.select
do
rngeg.offset(1,0).select
loop until rngeg.value = strFood
rngeg.offset(0,3) = strfood
Here txtEg.txt is the name of the input
textbox is from the user form
Problem is though its not working!!!! Hope someone can help thanks!!!
Now, i have an input box in my userform, from there i need a loop structure so that the value entered in the textbook is assessed in column a to match that data, if not then, it is offset by 1 row, and the next column is assessed whether it has the same data as well and the procedure repeats until the data entered corrsponds to the data in the cell.
Once matched it is offset by 3 columns and in it will be the data i entered in the data table.
Here's what i got:
Set rngeg = Application.ActiveWorkbook.Worksheets("sheet3").Range("a2")
strFood = txteg.Text
rngeg.select
do
rngeg.offset(1,0).select
loop until rngeg.value = strFood
rngeg.offset(0,3) = strfood
Here txtEg.txt is the name of the input
textbox is from the user form
Problem is though its not working!!!! Hope someone can help thanks!!!
Last edited: