were Textbox1 = Employee Number
and Textbox2 = Line Chooses
VBA Code:
>>> use code - tags <<<
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
[code]
when I type in 9324 in Textbox1 and 1.2.3 and textbox2 and press enter on the first set of data then type 6475 textbox1 and 10.9.8 in textbox2 and press enter for the second set of data The results I get with the above code is as follows:
[TABLE]
[TR]
[TH]D[/TH]
[TH]E[/TH]
[TH]F[/TH]
[TH]G[/TH]
[TH]H[/TH]
[TH]I[/TH]
[TH]J[/TH]
[/TR]
[TR]
[TD]9324[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]3[/TD]
[TD]10[/TD]
[TD]9[/TD]
[TD]8[/TD]
[/TR]
[TR]
[TD]6475[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[/TABLE]
What I need done is the second data of textbox2 to go with second data of textbox1 so results should be:
[TABLE]
[TR]
[TH]D[/TH]
[TH]E[/TH]
[TH]F[/TH]
[TH]G[/TH]
[TH]H[/TH]
[TH]I[/TH]
[TH]J[/TH]
[/TR]
[TR]
[TD]9324[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]3[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]6475[/TD]
[TD]10[/TD]
[TD]9[/TD]
[TD]8[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[/TABLE]
any help is greatly appreciated.
Last edited by a moderator: