This might move you a little farther in your quest
I renamed some controls for readability
You had two initialize subs - I combined them
Made some other tweaks (some just because it's my style)
Added "Add WS" code - seems to work (no error checking). SInce you can add worksheets, it'd be better I think to read the names into the combobox, instead of hard coding
Option Explicit
Private Sub UserForm_Initialize()
Dim ws As Worksheet
Me.txtDate.Text = Format(Now(), "mm/dd/yyyy")
For Each ws In ThisWorkbook.Worksheets
If ws.Name <> "MasterSheet" Then cboxSheet.AddItem ws.Name
Next
With cboxPriority
.AddItem "P1"
.AddItem "P2"
.AddItem "P3"
End With
End Sub
Private Sub btnAddData_Click()
Dim lastrow As Long
If cboxSheet.Value = "" Then Exit Sub
With Worksheets(cboxSheet.Value)
lastrow = .Cells(Rows.Count, 1).End(xlUp).Row
.Cells(lastrow + 1, 1).Value = txtDate.Value 'date
.Cells(lastrow + 1, 2).Value = TextBox2.Value 'item name
.Cells(lastrow + 1, 3).Value = TextBox3.Value 'section
.Cells(lastrow + 1, 4).Value = TextBox4.Value 'person responsible
.Cells(lastrow + 1, 5).Value = TextBox5.Value 'item name
.Cells(lastrow + 1, 6).Value = TextBox6.Value 'customer id
.Cells(lastrow + 1, 7).Value = TextBox7.Value 'batch
.Cells(lastrow + 1, 8).Value = TextBox8.Value 'comments
End With
MsgBox ("Data is added successfully")
End Sub
Private Sub btnClearForm_Click()
txtDate.Value = vbNullString
' etc.
End Sub
Private Sub btnCreateWorksheet_Click()
If Len(cboxSheet.Value) = 0 Then Exit Sub
Worksheets.Add.Name = cboxSheet.Value
'to get added sheet to show
cboxSheet.Clear
Call UserForm_Initialize '
End Sub
Private Sub btnExit_Click()
Me.Hide
Unload Me
End Sub
Private Sub btnSearch_Click()
MsgBox "Search Button"
End Sub