Could anyone help me use VBA code to stop users of the workbook from changing the cell reference style from r1c1 to a1 style?
Thanks.
Could anyone help me use VBA code to stop users of the workbook from changing the cell reference style from r1c1 to a1 style?
Thanks.
Re: Disable Changing R1c1 Style To A1 Style
I'm not sure if it is required, but I have written a lot of VBA code using r1c1 (writing r1c1 functions into cells), and don't want to take the change of it getting messed up when someone tries to change the style back to a1.
Thanks for your reply. I will try it out.[hr]*[/hr] Auto Merged Post Until 24 Hrs Passes;[dl]*[/dl]This gives me a runtime error 1004 : method failed
whenever I do anything in the workbook
Re: Disable Changing R1c1 Style To A1 Style
You can grey out Tools > options tab for the workbook. Place this code in ThisWorkbook and save the workbook. When the user opens it the option is greyed out and when they close the workbook the option is available again
Private Sub Workbook_Open()
Dim Opt As Object
Dim TB As Object
Set TB = Application.CommandBars("Worksheet Menu Bar").Controls("Tools")
Set Opt = TB.Controls("Options...")
Opt.Enabled = False
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim Opt As Object
Dim TB As Object
Set TB = Application.CommandBars("Worksheet Menu Bar").Controls("Tools")
Set Opt = TB.Controls("Options...")
Opt.Enabled = True
End Sub
VBA Noob
Re: Disable Changing R1c1 Style To A1 Style
Works like a charm. Thank you very much.
Re: Disable R1C1 Style Option To A1 Style
I agree this seems less brutal than hiding the option menu, however if I try to copy and paste something, the clipboard empties while in this sub, before I can hit paste.
I will have to stick with hiding the option menu unless there is a better way to accomplish this without bad side effects.
Any ideas are welcome!
Thanks
Don’t have an account yet? Register yourself now and be a part of our community!