Progress bar while adding data from Userform ( while macro runs )

charly1988

New Member
Joined
Jul 31, 2022
Messages
13
Office Version
  1. 2016
Platform
  1. Windows
Hello everyone, as i am new to excel vba i need some help for running a progress bar while i add data from userform. When i click add button progress bar should run till the "adding data" code runs. And finally want to show a massage box too say that process is successful. Below is the simple code i use 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

Thank you for your help in advance
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Welcome to the MrExcel Message Board!

Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: Progress bar while adding data from Userform ( while macro runs )
If you have posted the question at more places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0

Forum statistics

Threads
1,215,242
Messages
6,123,827
Members
449,127
Latest member
Cyko

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top