I have taken advice on this point previously and have managed to get the userform to load ( Many Thanks ) but i am having problems where i need a comboxbox to give several options ( Error highlighted in red below ). This will re occur as the user form when it loads has 3 options where the data can come from.
Also where the form can load is there anyway i can have a password option set for each one? If so how would i go about this?
All help apppreciated
Also where the form can load is there anyway i can have a password option set for each one? If so how would i go about this?
Rich (BB code):
Private Sub cmdsubmit_Click()
'Open file
Workbooks.Open Filename:="C:\Users\MAZZA\Documents\Gavin\Car Park\Data.xls"
Dim myBook As Workbook
On Error Resume Next
Set myBook = Application.Workbooks("Data.xls")
On Error GoTo 0
'If Ash Longman - Call Centre Enquiry
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Ash Longman")
If UserForm2.ComboBox1 = "Ash Longman" Then
ActiveWorkbook.Sheets("Ash Longman").Activate
Unload Me
UserForm1.Show False
For i = 3 To 65000
If Cells(i, 1) = "" Then Exit For
If Cells(i, 11) = "" Then
UserForm1.txtdate.Value = Cells(i, 1)
UserForm1.TextBox1.Value = Cells(i, 2)
UserForm1.TextBox2.Value = Cells(i, 3)
UserForm1.TextBox3.Value = Cells(i, 6)
UserForm1.TextBox6.Value = Cells(i, 4)
UserForm1.TextBox5.Value = Cells(i, 5)
UserForm1.TextBox4.Value = Cells(i, 7)
UserForm1.TextBox7.Value = Cells(i, 8)
UserForm1.TextBox8.Value = Cells(i, 9)
UserForm1.TextBox9.Value = Cells(i, 10)
With UserForm1.JEN.Value
UserForm1.AddItem "No"
UserForm1.AddItem "Yes"
End With
With CBoxAdd
.AddItem "Gavin Mazza"
.AddItem "Jeannette Yates"
.AddItem "Joshim Khan"
.AddItem "Mark Haslam"
.AddItem "Mark Taylor"
.AddItem "Mark Weikert"
.AddItem "Nicholas Sampson"
End With
With txtdate
.Enabled = False
End With
End If
Next
End If
'If Andy Morrell - callcentre enquiry
If UserForm2.ComboBox1 = "Andy Morrell" Then
ActiveWorkbook.Sheets("Andy Morrell").Activate
Unload Me
UserForm1.Show False
For i = 3 To 65000
If Cells(i, 1) = "" Then Exit For
If Cells(i, 11) = "" Then
UserForm1.txtdate.Value = Cells(i, 1)
UserForm1.TextBox1.Value = Cells(i, 2)
UserForm1.TextBox2.Value = Cells(i, 3)
UserForm1.TextBox3.Value = Cells(i, 6)
UserForm1.TextBox6.Value = Cells(i, 4)
UserForm1.TextBox5.Value = Cells(i, 5)
UserForm1.TextBox4.Value = Cells(i, 7)
UserForm1.TextBox7.Value = Cells(i, 8)
UserForm1.TextBox8.Value = Cells(i, 9)
UserForm1.TextBox9.Value = Cells(i, 10)
With JEN
.AddItem "No"
.AddItem "Yes"
End With
With CBoxAdd
.AddItem "David Watson"
.AddItem "John Smith"
.AddItem "Hannah Hill"
End With
With txtdate
.Enabled = False
End With
End If
Next
End If
'If Christine Whitty - callcentre enquiry
If UserForm2.ComboBox1 = "Christine Whitty" Then
ActiveWorkbook.Sheets("Christine Whitty").Activate
Unload Me
UserForm1.Show False
For i = 3 To 65000
If Cells(i, 1) = "" Then Exit For
If Cells(i, 11) = "" Then
UserForm1.txtdate.Value = Cells(i, 1)
UserForm1.TextBox1.Value = Cells(i, 2)
UserForm1.TextBox2.Value = Cells(i, 3)
UserForm1.TextBox3.Value = Cells(i, 6)
UserForm1.TextBox6.Value = Cells(i, 4)
UserForm1.TextBox5.Value = Cells(i, 5)
UserForm1.TextBox4.Value = Cells(i, 7)
UserForm1.TextBox7.Value = Cells(i, 8)
UserForm1.TextBox8.Value = Cells(i, 9)
UserForm1.TextBox9.Value = Cells(i, 10)
With JEN
.AddItem "No"
.AddItem "Yes"
End With
With CBoxAdd
.AddItem "Zenny Asghar"
.AddItem "Tim Nickson"
.AddItem "Michelle Hilton"
End With
With txtdate
.Enabled = False
End With
End If
Next
End If
End Sub
All help apppreciated