VBA Code:
Option Explicit
Sub Reset()
Dim iRow As Long
iRow = [Counta(Quotes!B:B] ' identify the last row
With frmForm
.TxtCompanyName.Value = ""
.txtProjectName.Value = ""
.TxtDate.Value = ""
.TxtNo.Value = ""
.TxtQuoteNo.Value = ""
.TxtItemNo.Value = ""
.TxtArea.Value = ""
.TxtDes1.Value = ""
.TxtDes2.Value = ""
.TxtHeight.Value = ""
.TxtLength.Value = ""
.TxtLevels.Value = ""
.TxtErect.Value = ""
.TxtHUI1.Value = ""
.TxtHUI2.Value = ""
.TxtHUI3.Value = ""
.TxtSTD.Value = ""
.TxtLCS.Value = ""
.TxtIB.Value = ""
.txtTMNo.Value = ""
.TxtTM.Value = ""
.TxtHUMNo.Value = ""
.TxtHUM.Value = ""
.TxtDismantle.Value = ""
.TxtTransport.Value = ""
.TxtSCS.Value = ""
.TxtSundry.Value = ""
.TxtSupplyBeams.Value = ""
.TxtOthers.Value = ""
.TxtENG.Value = ""
.TxtHire.Value = ""
.TxtHireWeeks.Value = ""
.TxtOH.Value = ""
.TxtWklyHire.Value = ""
.TxtTotal.Value = ""
.CmbConVar.Clear
.CmbConVar.AddItem "Subcontract"
.CmbConVar.AddItem "Variation"
.lstdatabase.ColumnCount = 33
.lstdatabase.ColumnHeads = True
.lstdatabase.ColumnWidths = "6.14,10.71,4.43,12.29,12.29,12.29,12.29,12.29,12.29,12.29,12.29,12.29,12.29,12.29,12.29,12.29,12.29,12.29,12.29,12.29,12.29,12.29,12.29,12.29,12.29,12.29,12.29,12.29,12.29,12.29,12.29,12.29,12.29,12.29,12.29,12.29"
If iRow > 1 Then
.lstdatabase.RowSource = "Quotes!B4:AH" & iRow
Else
.lstdatabase.RowSource = "Quotes!B4:AH"
End If
End With
End Sub
Sub Submit()
Dim sh As Worksheet
Dim iRow As Long
Set sh = ThisWorkbook.Sheets("Quotes")
iRow = [Counta(Quotes!B:B] + 1
With sh
.Cells(iRow, 1) = iRow - 1
.Cells(iRow, 2) = frmForm.TxtDate.Value
.Cells(iRow, 3) = frmForm.TxtNo.Value
.Cells(iRow, 4) = frmForm.CmbConVar.Value
.Cells(iRow, 5) = frmForm.TxtQuoteNo.Value
.Cells(iRow, 6) = frmForm.TxtItemNo.Value
.Cells(iRow, 7) = frmForm.TxtArea.Value
.Cells(iRow, 8) = frmForm.TxtDes1.Value
.Cells(iRow, 9) = frmForm.TxtDes2.Value
.Cells(iRow, 10) = frmForm.TxtHeight.Value
.Cells(iRow, 11) = frmForm.TxtLength.Value
.Cells(iRow, 12) = frmForm.TxtLevels.Value
.Cells(iRow, 13) = frmForm.TxtErect.Value
.Cells(iRow, 14) = frmForm.TxtHUI1.Value
.Cells(iRow, 15) = frmForm.TxtHUI2.Value
.Cells(iRow, 16) = frmForm.TxtHUI3.Value
.Cells(iRow, 17) = frmForm.TxtSTD.Value
.Cells(iRow, 18) = frmForm.TxtLCS.Value
.Cells(iRow, 19) = frmForm.TxtIB.Value
.Cells(iRow, 20) = frmForm.txtTMNo.Value
.Cells(iRow, 21) = frmForm.TxtTM.Value
.Cells(iRow, 22) = frmForm.TxtHUMNo.Value
.Cells(iRow, 23) = frmForm.TxtHUM.Value
.Cells(iRow, 24) = frmForm.TxtDismantle.Value
.Cells(iRow, 25) = frmForm.TxtTransport.Value
.Cells(iRow, 26) = frmForm.TxtSCS.Value
.Cells(iRow, 27) = frmForm.TxtSundry.Value
.Cells(iRow, 28) = frmForm.TxtSupplyBeams.Value
.Cells(iRow, 29) = frmForm.TxtOthers.Value
.Cells(iRow, 30) = frmForm.TxtENG.Value
.Cells(iRow, 31) = frmForm.TxtHire.Value
.Cells(iRow, 32) = frmForm.TxtHireWeeks.Value
.Cells(iRow, 33) = frmForm.TxtOH.Value
.Cells(iRow, 34) = frmForm.TxtWklyHire.Value
.Cells(iRow, 35) = frmForm.TxtTotal.Value
.Cells(iRow, 35) = Application.UserName
.Cells(iRow, 35) = [text(Now(),"DD-MM-YY HH:MM:SS")]
End With
End Sub
Sub Show_Form()
frmForm.Show
End Sub