Afternoon,
I hope you all can help me with an error on submitting a form.
I have data that is saved in a file where the form i have created pulls all the info from to fill the present form that is submitted when complete. The form isnt submitting the info it needs to as well as i cannot step in the code as it does what it should and just freezes. The first item needs to go in colum 14 and then populate the next 5 in that row.
I am hoping that you can all help as i am only a beigginer with VBA
Any help with this would be great
I hope you all can help me with an error on submitting a form.
I have data that is saved in a file where the form i have created pulls all the info from to fill the present form that is submitted when complete. The form isnt submitting the info it needs to as well as i cannot step in the code as it does what it should and just freezes. The first item needs to go in colum 14 and then populate the next 5 in that row.
I am hoping that you can all help as i am only a beigginer with VBA
Rich (BB code):
Private Sub cmdsubmit_Click()
Dim iRow As Long
Dim ws As Worksheet
If Me.JEN.Value = "" Then
MsgBox "Please Complete is this a justified Enquiry"
Else
If Me.AComm.Value = "" Then
MsgBox "Please Leave Your Comments"
Else
If Me.CBoxAdd.Value = "" Then
MsgBox "Please Enter Your Name"
Else
Workbooks.Open Filename:="C:\Users\MAZZA\Documents\Gavin\Car Park\Data.xls" 'Home
'Workbooks.Open Filename:="\\W2K6082\COMMON\SHARED\Gavin Mazza\Car Park\Data.xls"
If UserForm1.TextBox13 = "Ashley Longman" Then
ActiveWorkbook.Sheets("Ashley Longman").Activate
Unload Me
Set ws = Worksheets("Ashley Longman")
iRow = ws.Cells(Rows.Count, 14) _
.End(xlUp).Offset(1, 0).Row
'copy the data to the database
ws.Cells(iRow, 14).Value = Me.JEN.Value
ws.Cells(iRow, 16).Value = Me.TextBox12.Value
ws.Cells(iRow, 17).Value = Me.AComm.Value
ws.Cells(iRow, 18).Value = Me.CBoxAdd.Value
'clear the data
Me.JEN.Value = ""
Me.AComm.Value = ""
Me.CBoxAdd.Value = ""
Me.TextBox12.Value = ""
Me.txtdate.Enabled = True
Workbooks("Data.xls").Close True
End If
End If
End If
End If
If Me.JEN.Value = "" Then
MsgBox "Please Complete is this a justified Enquiry"
Else
If Me.AComm.Value = "" Then
MsgBox "Please Leave Your Comments"
Else
If Me.CBoxAdd.Value = "" Then
MsgBox "Please Enter Your Name"
Else
Workbooks.Open Filename:="C:\Users\MAZZA\Documents\Gavin\Car Park\Data.xls" 'Home
'Workbooks.Open Filename:="\\W2K6082\COMMON\SHARED\Gavin Mazza\Car Park\Data.xls"
If UserForm1.TextBox13 = "Christine Whitty" Then
ActiveWorkbook.Sheets("Christine Whitty").Activate
Unload Me
Set ws = Worksheets("Christine Whitty")
iRow = ws.Cells(Rows.Count, 14) _
.End(xlUp).Offset(1, 0).Row
'copy the data to the database
ws.Cells(iRow, 14).Value = Me.JEN.Value
ws.Cells(iRow, 16).Value = Me.TextBox12.Value
ws.Cells(iRow, 17).Value = Me.AComm.Value
ws.Cells(iRow, 18).Value = Me.CBoxAdd.Value
'clear the data
Me.JEN.Value = ""
Me.AComm.Value = ""
Me.CBoxAdd.Value = ""
Me.TextBox12.Value = ""
Me.txtdate.Enabled = True
Workbooks("Data.xls").Close True
End If
End If
End If
End If
If Me.JEN.Value = "" Then
MsgBox "Please Complete is this a justified Enquiry"
Else
If Me.AComm.Value = "" Then
MsgBox "Please Leave Your Comments"
Else
If Me.CBoxAdd.Value = "" Then
MsgBox "Please Enter Your Name"
Else
Workbooks.Open Filename:="C:\Users\MAZZA\Documents\Gavin\Car Park\Data.xls" 'Home
'Workbooks.Open Filename:="\\W2K6082\COMMON\SHARED\Gavin Mazza\Car Park\Data.xls"
If UserForm1.TextBox13 = "Andrew Mellor" Then
ActiveWorkbook.Sheets("Andrew Mellor").Activate
Unload Me
Set ws = Worksheets("Andrew Mellor")
iRow = ws.Cells(Rows.Count, 14) _
.End(xlUp).Offset(1, 0).Row
'copy the data to the database
ws.Cells(iRow, 14).Value = Me.JEN.Value
ws.Cells(iRow, 16).Value = Me.TextBox12.Value
ws.Cells(iRow, 17).Value = Me.AComm.Value
ws.Cells(iRow, 18).Value = Me.CBoxAdd.Value
'clear the data
Me.JEN.Value = ""
Me.AComm.Value = ""
Me.ComboBox2.Value = ""
Me.CBoxAdd.Value = ""
Me.TextBox12.Value = ""
Me.txtdate.Enabled = True
Workbooks("Data.xls").Close True
End If
End If
End If
End If
End Sub
Any help with this would be great
Last edited: