Find invoice and fill name accordingly using vba

Kamal GKJ

New Member
Joined
Aug 17, 2017
Messages
32
Dear ALL,

Hope you are doing good, I have a dump of data (invoice number's) and multiple data in excel. If there are 10 employee's but each can process different number's of invoice's. Here is what I want to do.

If a person is handling the invoice while taking the invoice he should enter his name(VBA sheet or form) and the name should be amended on the respective column against to the invoice number.

Eg O/P
Invoice number Agent name
12345 XXXX
14567 TTTTT
23567 RRRR
19635 LLLLL:eek::eek::eek::eek:

Thanks in advance.
 
OK.

I always need specific details.

1.I assume you have a button on a Userform and when you press this button the script will run

And you must have a Textbox on the Userform where the user enters his name
And you must have a Textbox on the Userform where the user enters the invoice number.

Or better yet the user would select the invoice number from a list of invoice numbers in a Combobox or listbox

So the script would be sort of like this:

Look down column A for the invoice number selected in Combobox1 or Listbox1 and enter the name entered in Textbox1 Into same row column B



Now I need to know the name of the Textbox where the user enters his name
And I need the name of the Textbox or Combobox or listbox where he selects or enters the invoice number.

We could load all the invoice numbers into a Combobox so you choose from the combobox so there are no mistakes

We would load the Combobox like this:

Combobox1.List= Range("A1:A400").value

Or something like that if you wanted to do things like that.
Please provide specific details like this.

I Am sorry I am new to VBA

Please find the code in userForm:

Private Sub ComboBox1_Change()
ComboBox1.List = Range("B1:B1000")
End Sub


Private Sub TextBox1_Change()


End Sub
 
Upvote 0

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
You need a Combobox named Combobox1
You need a Textbox named Textbox1

And put this script in your UserForm

The combobox will be loaded with values when Userform is shown

When you choose a value in the combobox the script will run
Put the Employee name in Textbox1
Code:
Private Sub ComboBox1_Change()
'Modified 6/29/18 9:15 AM EDT
If TextBox1.Value = "" Then MsgBox "You failed to enter a value in TextBox1" & vbNewLine & "I will now stop the script": Exit Sub
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Dim SearchString As String
Dim SearchRange As Range
SearchString = ComboBox1.Value
Set SearchRange = Range("A1:A" & Lastrow).Find(SearchString, LookIn:=xlValues, lookat:=xlWhole)
If SearchRange Is Nothing Then MsgBox "Value not found": Exit Sub
SearchRange.Offset(, 1).Value = TextBox1.Value
TextBox1.Value = ""
End Sub
Private Sub UserForm_Initialize()
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row
ComboBox1.List = Range("A1:A" & Lastrow).Value
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,085
Messages
6,128,733
Members
449,465
Latest member
TAKLAM

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