ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,737
- Office Version
- 2007
- Platform
- Windows
Afternoon,
The current working code is supplied below,
Basically it allows me to keep certain information about my customers with regards their purchase from me.
Currently it works like this.
I enter the new customers name in TextBox 2 like example JOHN SMITH "this is his first purchase"
I complete the other fields and transfer to worksheet.
Lets say next month this same customer makes another purchase from me, the code does not allow two of the same name SO when i enter JOHN SMITH the code automatically adds 002 to his name, So thus JOHN SMITH 002 & so on into the future JOHN SMITH 003 JOHN SMITH 004 for each purchase made etc etc
What this required edit would be is to add 001 after a new customer.
So i type DAVID BECKHAM the codes does not see another match so adds 001, So thus DAVID BECKHAM 001.
Upon the next purchase when i type DAVID BECKHAM the code automatically adds 002 like before.
My worksheet will then have an entire list of customers names followed by 001, 002, 003 etc etc
Many thanks & have a nice day
The current working code is supplied below,
Basically it allows me to keep certain information about my customers with regards their purchase from me.
Currently it works like this.
I enter the new customers name in TextBox 2 like example JOHN SMITH "this is his first purchase"
I complete the other fields and transfer to worksheet.
Lets say next month this same customer makes another purchase from me, the code does not allow two of the same name SO when i enter JOHN SMITH the code automatically adds 002 to his name, So thus JOHN SMITH 002 & so on into the future JOHN SMITH 003 JOHN SMITH 004 for each purchase made etc etc
What this required edit would be is to add 001 after a new customer.
So i type DAVID BECKHAM the codes does not see another match so adds 001, So thus DAVID BECKHAM 001.
Upon the next purchase when i type DAVID BECKHAM the code automatically adds 002 like before.
My worksheet will then have an entire list of customers names followed by 001, 002, 003 etc etc
Code:
Private Sub PostageSheetTransferButton_Click()Cancel = 0
If TextBox2.Text = "" Then
Cancel = 1
MsgBox "Customer`s Name Not Entered", vbCritical, "POSTAGE TRANSFER SHEET"
TextBox2.SetFocus
ElseIf TextBox3.Text = "" Then
Cancel = 1
MsgBox "Item Description Not Entered", vbCritical, "POSTAGE TRANSFER SHEET"
TextBox3.SetFocus
ElseIf TextBox4.Text = "" Then
Cancel = 1
MsgBox "Tracking Number Not Entered", vbCritical, "POSTAGE TRANSFER SHEET"
TextBox4.SetFocus
ElseIf ComboBox1.Text = "" Then
Cancel = 1
MsgBox "Username Not Entered", vbCritical, "POSTAGE TRANSFER SHEET"
ComboBox1.SetFocus
ElseIf OptionButton1.Value = False And OptionButton2.Value = False And OptionButton3.Value = False Then
Cancel = 1
MsgBox "You Must Select An Ebay Account", vbCritical, "POSTAGE TRANSFER SHEET"
ElseIf OptionButton4.Value = False And OptionButton5.Value = False And OptionButton6.Value = False Then
Cancel = 1
MsgBox "You Must Select An Origin", vbCritical, "POSTAGE TRANSFER SHEET"
End If
If Cancel = 1 Then
Exit Sub
End If
Dim i As Long
Dim x As Long
Dim ctrl As Control
Dim lastrow As Long
lastrow = ThisWorkbook.Worksheets("POSTAGE").Cells(Rows.Count, 1).End(xlUp).Row
With ThisWorkbook.Worksheets("POSTAGE")
.Cells(lastrow + 1, 1).Value = TextBox1.Text: TextBox1.Value = ""
.Cells(lastrow + 1, 2).Value = TextBox2.Text: TextBox2.Value = ""
.Cells(lastrow + 1, 3).Value = TextBox3.Text: TextBox3.Value = ""
.Cells(lastrow + 1, 5).Value = TextBox4.Text: TextBox4.Value = ""
.Cells(lastrow + 1, 9).Value = ComboBox1.Text: ComboBox1.Value = ""
.Cells(lastrow + 1, 4).Value = TextBox6.Text: TextBox6.Value = ""
If OptionButton1.Value = True Then .Cells(lastrow + 1, 8).Value = "DR": OptionButton1.Value = False
If OptionButton2.Value = True Then .Cells(lastrow + 1, 8).Value = "IVY": OptionButton2.Value = False
If OptionButton3.Value = True Then .Cells(lastrow + 1, 8).Value = "N/A": OptionButton3.Value = False
If OptionButton4.Value = True Then .Cells(lastrow + 1, 6).Value = "EBAY": OptionButton4.Value = False
If OptionButton5.Value = True Then .Cells(lastrow + 1, 6).Value = "WEB SITE": OptionButton5.Value = False
If OptionButton6.Value = True Then .Cells(lastrow + 1, 6).Value = "N/A": OptionButton6.Value = False
MsgBox "Customer Postage Sheet Updated", vbInformation, "SUCCESSFUL MESSAGE"
End With
TextBox1.Value = Format(CDbl(Date), "dd/mm/yyyy")
TextBox2.SetFocus
TextBox1.Value = Now
TextBox1.Value = Format(CDbl(Date), "dd/mm/yyyy")
End Sub
Many thanks & have a nice day