In this code we will see how we can get the count of users active in a workbook; there may be a situation in which we need to get the count if active users in a shared workbook so basically we get the count of users who are connected to the workbook.
We will try to find number of users that are currently using the workbook.
Step 1
Open VB editor from Develop the workbook in which we will write the code to get the number of users currently using the workbook.
Step 2
Insert a module in which we will the VBA code.
Step 3
Now double click the newly created module to open that and paste the below code in the module.
Sub Get_No_Of_users()
Users = ActiveWorkbook.UserStatus
MsgBox “Total Users using the current WorkBook: ” & UBound(Users)
End Sub
This code will display the number of users who are currently using the excel workbook in a message box, you can modify this to get the count of users using the workbook in a cell value.
Hope this helped.