Can someone help me on my workbook?
I have "add data" form. It is working but i want to add sheet name on drop down list ( automatically list down the database sheets).
So that i can choose which database should the data on the text boxes should be place .
As of now i can only add data to database 2010 sheet and i want to add more sheet (Database 2011,Database 2012...etc)
Here is my code and workbook:
Code:
Private Sub cmdAdd_Click()
Dim lRow As Long
Dim inputWks As Worksheet
Dim ws As Worksheet
Set ws = Worksheets("Database 2010")
' Find emtpy row
lRow = ws.Cells(Rows.Count, 4).End(xlUp).Offset(1, 0).Row
'Add data to worksheet
ws.Cells(lRow, "C") = Me.txtJobNo.Value
ws.Cells(lRow, "D") = Me.txtJobName.Value
ws.Cells(lRow, "E") = Me.txtRal.Value
ws.Cells(lRow, "F") = Me.txtArea.Value
ws.Cells(lRow, "G") = Me.txtPwdrUse.Value
ws.Cells(lRow, "H") = Me.txtPercent.Value
ws.Cells(lRow, "I") = Me.txtGasLtr.Value
ws.Cells(lRow, "J") = Me.txtPwdrCost.Value
ws.Cells(lRow, "K") = Me.txtGasCost.Value
ws.Cells(lRow, "L") = Me.txtCoverage.Value
ws.Cells(lRow, "M") = Me.txtTotalCost.Value
ws.Cells(lRow, "N") = Me.txtRemarks.Value
'Clear userform
txtJobName.Value = vbNullString
txtJobNo.Value = vbNullString
txtRal.Value = vbNullString
txtArea.Value = vbNullString
txtPwdrUse.Value = vbNullString
txtPercent.Value = vbNullString
txtGasLtr.Value = vbNullString
txtPwdrCost.Value = vbNullString
txtGasCost.Value = vbNullString
txtCoverage.Value = vbNullString
txtTotalCost.Value = vbNullString
txtRemarks.Value = vbNullString
End Sub
Private Sub cmdReset_Click()
txtJobName.Value = ""
txtJobNo.Value = ""
txtRal.Value = ""
txtArea.Value = ""
txtPwdrUse.Value = ""
txtPercent.Value = ""
txtGasLtr.Value = ""
txtPwdrCost.Value = ""
txtGasCost.Value = ""
txtCoverage.Value = ""
txtTotalCost.Value = ""
txtRemarks.Value = ""
End Sub
Thanks in advance!
Bookmarks