K
Kev
Code from my UserForm
Private Sub cmdOk_Click()
CustName = UserForm1.CustName
If Len(CustName) < 1 Then Exit Sub
Set Customers = Sheets("Customer List").Range
("Customers")
If WorksheetFunction.CountIf(Customers, CustName) > 0
Then Exit Sub
With Sheets("Customer List")
clastrow = .Cells(Rows.Count, "A").End(xlUp).Row
.Range("A" & clastrow + 1).Value = CustName
.Range("Customers").Cells(1, 1).Resize(clastrow +
1, Range("Customers").Columns.Count).Name = "Customers"
End With
Unload Me
Sheets("Customer List").Select
Selection.Sort Key1:=Range("Customers"),
Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End Sub
******************************************
Code from AutoShape macro to start UserForm
Sub CustAllocInput_AutoShape1_Click()
UserForm1.Show
UserForm1.Hide
Sheets("CustAllocInput").Select
Range("CustList1").Select
End Sub
*******************************************
If the UserForm code completes all the way through the
last two lines in the AutoShape macro are performed.
However if either of the two EXIT SUB conditions occur
the user form stays on the screen and the code goes no
further. I want for each EXIT SUB condition, the code to
complete the last two lines of the AutoShape macro.
Where is my error and the fix please?
Thanks a million....
Kev.
Private Sub cmdOk_Click()
CustName = UserForm1.CustName
If Len(CustName) < 1 Then Exit Sub
Set Customers = Sheets("Customer List").Range
("Customers")
If WorksheetFunction.CountIf(Customers, CustName) > 0
Then Exit Sub
With Sheets("Customer List")
clastrow = .Cells(Rows.Count, "A").End(xlUp).Row
.Range("A" & clastrow + 1).Value = CustName
.Range("Customers").Cells(1, 1).Resize(clastrow +
1, Range("Customers").Columns.Count).Name = "Customers"
End With
Unload Me
Sheets("Customer List").Select
Selection.Sort Key1:=Range("Customers"),
Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End Sub
******************************************
Code from AutoShape macro to start UserForm
Sub CustAllocInput_AutoShape1_Click()
UserForm1.Show
UserForm1.Hide
Sheets("CustAllocInput").Select
Range("CustList1").Select
End Sub
*******************************************
If the UserForm code completes all the way through the
last two lines in the AutoShape macro are performed.
However if either of the two EXIT SUB conditions occur
the user form stays on the screen and the code goes no
further. I want for each EXIT SUB condition, the code to
complete the last two lines of the AutoShape macro.
Where is my error and the fix please?
Thanks a million....
Kev.