Hi,
Im creating a userform that pulls lines of data from a worksheet based on 1 criteria at the moment (working on second criteria).
im having trouble inserting the data using criteria's to determine which cells the new data populates.
This is the userform and code im using at the moment to pull the data from the worksheet, Column A,B,E are left empty as these are the columns i want to populate using the userform above.
once there is data in "Date" "Num" and "Time" i want to be able to insert these values in to the empty cells on the worksheet using the "Update" CmdButton.
Also with the work sheet there could be 1-8 cells with the exact same data hence why the userform has so many lines, i was planning to use "Line" as a second reference so it would be easier to insert the new data in too A,B,E
Im creating a userform that pulls lines of data from a worksheet based on 1 criteria at the moment (working on second criteria).
im having trouble inserting the data using criteria's to determine which cells the new data populates.
VBA Code:
Private Sub CommandButton1_Click()
TextBox3.Value = Application.WorksheetFunction.Index(Sheets("Allocate").Range("A2:N100"), Application.WorksheetFunction.Match(TextBox4.Value, Sheets("allocate").Range("D:D"), 0), 3)
TextBox6.Value = Application.WorksheetFunction.Index(Sheets("Allocate").Range("A2:N100"), Application.WorksheetFunction.Match(TextBox4.Value, Sheets("allocate").Range("D:D"), 0), 6)
TextBox7.Value = Application.WorksheetFunction.Index(Sheets("Allocate").Range("A2:N100"), Application.WorksheetFunction.Match(TextBox4.Value, Sheets("allocate").Range("D:D"), 0), 7)
TextBox8.Value = Application.WorksheetFunction.Index(Sheets("Allocate").Range("A2:N100"), Application.WorksheetFunction.Match(TextBox4.Value, Sheets("allocate").Range("D:D"), 0), 8)
TextBox9.Value = Application.WorksheetFunction.Index(Sheets("Allocate").Range("A2:N100"), Application.WorksheetFunction.Match(TextBox4.Value, Sheets("allocate").Range("D:D"), 0), 9)
TextBox10.Value = Application.WorksheetFunction.Index(Sheets("Allocate").Range("A2:N100"), Application.WorksheetFunction.Match(TextBox4.Value, Sheets("allocate").Range("D:D"), 0), 10)
TextBox11.Value = Application.WorksheetFunction.Index(Sheets("Allocate").Range("A2:N100"), Application.WorksheetFunction.Match(TextBox4.Value, Sheets("allocate").Range("D:D"), 0), 11)
TextBox12.Value = Application.WorksheetFunction.Index(Sheets("Allocate").Range("A2:N100"), Application.WorksheetFunction.Match(TextBox4.Value, Sheets("allocate").Range("D:D"), 0), 12)
TextBox13.Value = Application.WorksheetFunction.Index(Sheets("Allocate").Range("A2:N100"), Application.WorksheetFunction.Match(TextBox4.Value, Sheets("allocate").Range("D:D"), 0), 13)
TextBox14.Value = Application.WorksheetFunction.Index(Sheets("Allocate").Range("A2:N100"), Application.WorksheetFunction.Match(TextBox4.Value, Sheets("allocate").Range("D:D"), 0), 14)
End Sub
This is the userform and code im using at the moment to pull the data from the worksheet, Column A,B,E are left empty as these are the columns i want to populate using the userform above.
once there is data in "Date" "Num" and "Time" i want to be able to insert these values in to the empty cells on the worksheet using the "Update" CmdButton.
Also with the work sheet there could be 1-8 cells with the exact same data hence why the userform has so many lines, i was planning to use "Line" as a second reference so it would be easier to insert the new data in too A,B,E