Need Vba querry for user form

Kamran01

Board Regular
Joined
Feb 10, 2017
Messages
86
Dear Experts,

I have an excel sheet data and i want add remarks against emplyee code in remarks column.
Data is as per below details.

Column A - Emp_code (Already filled)
Column B - Emp_Name
(Already filled)
Column C - Remarks (Need to fill by user form)

Kindly help me out and give me user form querry.
Best regard
Kamran
 
Last edited:

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Here is my suggestion:
Add a ComboBox to your UserForm.
Name the ComboBox "ComboBox1"
That is the default name.
Add a TextBox to your UserForm
Name the TextBox "TextBox1"
Add a CommandButton to your UserFom
Name the CommandButton "CommandButton1"

Now put these three scripts in your UserForm:
When you open your UserForm:
The ComboBox will be loaded with all your names in column "B"
Select a name from the ComboBox and then enter your "Remarks" in TextBox1
Now click on Command Button1 and your script should run doing what you want.


Code:
Private Sub UserForm_Initialize()
ComboBox1.List = Range("B2:B" & Cells(Rows.Count, "B").End(xlUp).Row).Value
End Sub
Private Sub CommandButton1_Click()
On Error GoTo M
Dim SearchString As String
Dim SearchRange As Range
SearchString = ComboBox1.Value
Set SearchRange = Range("B2:B" & Cells(Rows.Count, "B").End(xlUp).Row).Find(SearchString, LookIn:=xlValues, lookat:=xlWhole)
SearchRange.Offset(0, 1).Value = TextBox1.Value
Exit Sub
M:
MsgBox "No such name as  " & ComboBox1.Value & "  Found"
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,592
Messages
6,120,433
Members
448,961
Latest member
nzskater

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