vookup copy and paset from user form to sheet

gurpartap008

New Member
Joined
Sep 16, 2014
Messages
6
Hello sir

i have tbox1 and tbox2 and a command button
i want command button do that:-

first see text box1 value and match with vlookup range Sheet1 (A1 to A20) suppose we enter 5 in textbox1 and 5 is on a6
then we enter "123456" in textbox 2,
now the command button do that the value we enter in tbox2"123456" is paste in b6 ("a6=5 and b6=123456")
please help me sir
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Would you enter values in tbox1 and tbox2 before clicking the command button? or you enter in tbox1, then click OK - after which you enter a value in tbox2 and then click the commandbutton?
 
Upvote 0
i want enter a value in tbox1 and tbox2 and then click on the commandbutton? please help sir as early as posiable
 
Last edited:
Upvote 0
i want enter a value in tbox1 and tbox2 and then click on the commandbutton? please help sir as early as posiable

If the command button is called "commandbutton1", then use this code as is, else change the name as appropriate

Code:
Private Sub CommandButton1_Click()
    Dim foundrow As Integer, wks As Worksheet
    Set wks = Worksheets("Sheet1")
    foundrow = wks.Range("A1:A20").Find(tbox1.Value, wks.Range("A1")).Row
    wke.Range("A" & foundrow).Offset(0, 1).Value = tbox2.Value
End Sub
 
Upvote 0
cant work sir plz help me through team viewer can i sen u ID


Private Sub CommandButton1_Click() Dim foundrow As Integer, wks As Worksheet Set wks = Worksheets("Sheet1") foundrow = wks.Range("A1:A20").Find(tbox1.Value, wks.Range("A1")).Row wke.Range("A" & foundrow).Offset(0, 1).Value = tbox2.Value End Sub</pre>
 
Last edited:
Upvote 0
cant work sir plz help me through team viewer can i sen u ID


Private Sub CommandButton1_Click() Dim foundrow As Integer, wks As Worksheet Set wks = Worksheets("Sheet1") foundrow = wks.Range("A1:A20").Find(tbox1.Value, wks.Range("A1")).Row wke.Range("A" & foundrow).Offset(0, 1).Value = tbox2.Value End Sub
Apparently, thats a mistake on my part, it should be "wks" not "wke"

Code:
Private Sub CommandButton1_Click()
    Dim foundrow As Integer, wks As Worksheet
    Set wks = Worksheets("Sheet1")
    foundrow = wks.Range("A1:A20").Find(tbox1.Value, wks.Range("A1")).Row
    wks.Range("A" & foundrow).Offset(0, 1).Value = tbox2.Value
End Sub
 
Upvote 0
Private Sub CommandButton1_Click()
Dim foundrow As Integer, wks As Worksheet
Set wks = Worksheets("Sheet1")
foundrow = wks.Range("A1:A20").Find(tbox1.Value, wks.Range("A1")).Row
wks.Range("A" & foundrow).Offset(0, 1).Value = tbox2.Value
End Sub
 
Upvote 0

Forum statistics

Threads
1,213,563
Messages
6,114,329
Members
448,564
Latest member
ED38

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