Inputting data to a specific cell?

Central99

New Member
Joined
Aug 8, 2011
Messages
4
I have created a simple userform containing a combobox and text box. The combobox is a range of number's 1-20. I have listed in column "A" 1-20. My question is, how can I have a user select a value from the drop down menu and have the information they provide get recorded in the corresponding numbered row?

Also, this is being done in VBA, so coding examples would be helpful!

The worksheet I have created is for a list of tasks, once a task is completed, the user chooses the task # and inputs their initials. Thanks for taking the time to help!
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Hi there, welcome to the board;

Try this bit of code, see if it works for you;
Code:
Private Sub ComboBox1_Change()
W = ComboBox1.Value
Cells.Find(What:=(W), After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
        xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
        , SearchFormat:=False).Activate
        ActiveCell.Offset(0, 1) = TextBox1.Value
End Sub

HTH
Colin
 
Upvote 0
Thank you very much! That works to an extent, I believe that my "activecell.offset" is counting from the last input I had, which makes the task number I choose to sign-off, not get recorded into the correct cell. If I wanted someone to be able to choose any task number and sign it off, is there a way to just choose from a list, so it doesn't have to go in any particular order? Almost like a vblookup?
 
Upvote 0
The 'ActiveCell.Offset' is based on what is choosen in the combobox. To test this I inputted 1-20 in ("A1:A20") and added 1-20 into the combobox, when some text is entered into the textbox and a number is chosen from the combobox the code searches for the value of the combobox and when found offset's 1 column to the right and pastes the value of the textbox.

Can you explain a bit more of what is happening, or what you are expecting as I may have mis-interpreted your question.

Cheers
Colin
 
Upvote 0
You are understanding it correctly, but occasionally the textbox data will jump over multiple columns. When I input the same task number again, it works. It's always task number 19 and 14 for some bizarre reason.

Example: I choose task 14 ("A17") to sign-off, the Initials should go into ("B17"), but end up in ("D14").

I thought maybe it was because I a "4" and "14" and maybe it was just looking at the last digit, so I added "0" before all the single digit numbers, but still didn't work.
 
Upvote 0
It appears to be finding the row number's and inputting the data in that row. I have a header taking up the first 2 rows of my worksheet, so the tasks do not match up with the row numbers. Also, I have named "A4:A23" 'Task' , is there a way to specify in my code to just search in that group of data?
 
Upvote 0
I can't replicate what is happening. Can you post your entire code?

If you wish to PM me your email I will send you a sample workbook.

Cheers
Colin
 
Upvote 0

Forum statistics

Threads
1,224,574
Messages
6,179,628
Members
452,933
Latest member
patv

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