Sonneillon
New Member
- Joined
- Nov 29, 2017
- Messages
- 2
Hi,
I'm not really sure if this could be done; but I was wondering if there is a way to sync a shared workbook with all users before saving the workbook? At present, I am building a simple worksheet for team members to record the times they will be going on each day. We are limited to the amount of people who can be on break at the same time due to customer demand. I have a simple formula which flags a cell as false if too many people are on break at the same time, or if someone is trying to take too many breaks, and if the cell is false, the document won't save.
The problem I have is the team consists of 11 people, so there is a small potential that multiple people will book the same time -- too many on break at once and they will save the sheet, not knowing the time will become unavailable, which will cause the macro to break and corrupt the file. Is there an alternative to this? Perhaps an auto-save every minute, or a way to sync the spreadsheets before the save takes affect?
The macro I'm using at the moment:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If ActiveSheet.Range("A15").Value = ">1" Then
Cancel = True
MsgBox "Unable to Save, too many people on break at one time"
Next
If ActiveSheet.Range("A15").Value = ">1" Then
Cancel = True
MsgBox "Unable to Save, too many people on break at one time"
End If
End Sub
Many thanks if anyone is able to help
I'm not really sure if this could be done; but I was wondering if there is a way to sync a shared workbook with all users before saving the workbook? At present, I am building a simple worksheet for team members to record the times they will be going on each day. We are limited to the amount of people who can be on break at the same time due to customer demand. I have a simple formula which flags a cell as false if too many people are on break at the same time, or if someone is trying to take too many breaks, and if the cell is false, the document won't save.
The problem I have is the team consists of 11 people, so there is a small potential that multiple people will book the same time -- too many on break at once and they will save the sheet, not knowing the time will become unavailable, which will cause the macro to break and corrupt the file. Is there an alternative to this? Perhaps an auto-save every minute, or a way to sync the spreadsheets before the save takes affect?
The macro I'm using at the moment:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If ActiveSheet.Range("A15").Value = ">1" Then
Cancel = True
MsgBox "Unable to Save, too many people on break at one time"
Next
If ActiveSheet.Range("A15").Value = ">1" Then
Cancel = True
MsgBox "Unable to Save, too many people on break at one time"
End If
End Sub
Many thanks if anyone is able to help