I am trying to have the ComboBox1 selection determine the row that the value from TextBox3 will be placed, as well as have TextBox2 determine the column that it will go in. The below code achieves the row that it will be placed, however, I can't seem to get the column to work correctly.
This version of the code is placing the value in the column number of TextBox2. So if I input 10 as the ID, then the textbox3 value will be placed in the tenth column. I need the textbox2 value to act as a lookup on row 4, while maintaining the ability to determine the row based on the ComboBox1
This version of the code is placing the value in the column number of TextBox2. So if I input 10 as the ID, then the textbox3 value will be placed in the tenth column. I need the textbox2 value to act as a lookup on row 4, while maintaining the ability to determine the row based on the ComboBox1
VBA Code:
Private Sub CommandButton1_Click()
Dim ws As Worksheet
Dim N As Long
Dim i As Long
Dim Rng As Range
Set ws = Sheets("C-Proposal-19")
Set Rng = ws.Range("4:4").Find(Me.TextBox2.Value)
N = Worksheets("C-Proposal-19").Cells(Rows.Count, "B").End(xlUp).Row
For i = 5 To N
If Worksheets("C-Proposal-19").Cells(i, "B").Value = frmAddAdj.ComboBox1.Value Then
Worksheets("C-Proposal-19").Cells(i, "Rng").Value = frmAddAdj.TextBox3.Text
Exit Sub
End If
Next i
End Sub