Transfer data to cell with matching row and header

djossh

Board Regular
Joined
Jul 27, 2009
Messages
243
Hi, I have a userform with 3 textbox. textbox1 is for Row (Criteria) textbox2 is for Header (Criteria) and textbox3 for Data entry.
i would like to transfer the Data in textbox3 to Sheet1 of my worksheets that match the Row and Header from my textbox1 & texbox2
thanks for the help. please see sample pictures. thanks again
 

Attachments

  • SCSHOT.jpg
    SCSHOT.jpg
    103.2 KB · Views: 8

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Hello,

This should work for you:
VBA Code:
Private Sub CommandButton1_Click()
  Dim a As Object
  Set a = Application
  With Worksheets("Sheet1")
  If Not IsError(a.Match(TextBox1.Text, .Range("A:A"), 0)) And Not IsError(a.Match(TextBox2.Text, .Range("1:1"), 0)) Then
    .Cells(a.Match(TextBox1.Text, .Range("A:A"), 0), a.Match(TextBox2.Text, .Range("1:1"), 0)).Value = TextBox3.Text
  End If
  End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,089
Messages
6,123,058
Members
449,091
Latest member
ikke

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