were Textbox1 = Employee Number
and Textbox2 = Line Chooses
VBA Code:
Private Sub CommandButton1_Click()
Dim EmpID$, dDate$, Rg As Range, i&, x&
EmpID = TextBox1.Value
If TextBox1.Value = "" Or TextBox2.Value = "" Then
MsgBox "PLEASE FILL IN EMPLOYEE NUMBER & ENTER BID LINE CHOOSES ... ", vbExclamation: Exit Sub
End If
If Not IsNumeric(EmpID) Then MsgBox "INVALID EMPLOYEE NUMBER ENTER NUMBER WITHOUT THE E", vbExclamation: Exit Sub
With Sheets("SHIFT BIDS")
For i = 1 To 2
dDate = IIf(i = 1, TextBox1.Value, TextBox2.Value)
If Len(dDate) > 0 Then
Set Rg = .Columns(1).Find(EmpID, lookat:=xlWhole)
If Rg Is Nothing Then
MsgBox "EMPLOYEE NUMBER DOES NOT EXIST PLEASE TRY AGAIN", vbExclamation: Exit Sub
Else
Set Rg = IIf(i = 1, ThisWorkbook.Sheets("Bid Data").Cells(, "D").Resize(500), ThisWorkbook.Sheets("Bid Data").Cells(, "E").Resize(, 500))
If InStr(dDate, ".") Then
For x = 0 To UBound(Split(dDate, "."))
Next
For x = 0 To UBound(Split(dDate, "."))
Rg.Find("", after:=Rg.Cells(Rg.Count)) = Split(dDate, ".")(x)
Next
Else
Rg.Find("", after:=Rg.Cells(Rg.Count)) = dDate
End If
End If
End If
Next
End With
TextBox1.Value = ""
TextBox2.Value = ""
TextBox1.SetFocus
End Sub
D | E | F | G | H | I | J |
---|---|---|---|---|---|---|
9324 | 1 | 2 | 3 | 10 | 9 | 8 |
6475 |
What I need done is the second data of textbox2 to go with second data of textbox1 so results should be:
D | E | F | G | H | I | J |
---|---|---|---|---|---|---|
9324 | 1 | 2 | 3 | | | |
6475 | 10 | 9 | 8 |
any help is greatly appreciated.