I want a progress bar while I add data from a userform.
When I click the add button the progress bar should run while the "adding data" code runs.
And finally I want to a message box to say the process is successful.
Code to add data from userform to Excel worksheet.
Private Sub cmbAddItem_Click()
Dim sht As Worksheet
Dim LastRow As Long
Set sht = ThisWorkbook.Sheets("ITEMS")
Dim rng As Range
Set rng = sht.Range("ITEM_LIST").CurrentRegion
LastRow = rng.End(xlDown).Row + 1
With sht
.Cells(LastRow, 3) = lblItemId
.Cells(LastRow, 4) = txtItemname
.Cells(LastRow, 5) = lblDate
.Cells(LastRow, 6) = txtItemDes
.Range("ITEM_LIST").Rows(rng.Rows.Count).Font.Name = "Franklin Gothic Book"
.Range("ITEM_LIST").Rows(rng.Rows.Count).HorizontalAlignment = xlCenter
End With
'--------------------------- load listbox or refresh listbox by class
loaditemlist
Call ItemCode ' update item code label for next item
lblTotItem = Application.CountA(Range("ITEM_CODE")) ' To Refresh
ThisWorkbook.Save
End sub