Hi,
I am runinng the code below on a protected worksheet and it runs fine. However when I also add the shared workbook feature there is an error in the code. The system is going to be used by multiple users so it needs to be shared and protected. I have tried using Worksheets("Master").UnprotectSharing to work round this but it doesn't seem to work. Could anyone offer some advice?
Private Sub submitOrder_Click()
Dim valid As Boolean
Dim dateToday As Date
'Unprotect spreadsheet
Worksheets("Master").Unprotect ("fx")
'Find the last row
Row = Range("A65536").End(xlUp).Row
Row = Row + 1
'Populate next row
Worksheets("Master").Cells(Row, 1).Value = customerInput.Value
Worksheets("Master").Cells(Row, 2).Value = currencyPair.Value
Worksheets("Master").Cells(Row, 3).Value = direction.Value
Worksheets("Master").Cells(Row, 4).Value = amount.Value
Worksheets("Master").Cells(Row, 5).Value = fixType.Value
Worksheets("Master").Cells(Row, 6).Value = todayDate.Value
Worksheets("Master").Cells(Row, 7).Value = fixTime.Value
Worksheets("Master").Cells(Row, 8).Value = dealer.Value
'Change colour of cell and put placed in confirmed order
Worksheets("Master").Cells(Row, 9) = "Placed" 'Put Placed in cell
Worksheets("Master").Cells(Row, 9).Interior.ColorIndex = 15 'Change colour of cell
'Close form
Unload Me
'Save spreadsheet
'ActiveWorkbook.Save
'Protect spreadsheet
Worksheets("Master").Protect ("fx")
End If
End Sub
Bookmarks