ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Error 400 on making row visible on a protected sheet (https://www.excelbanter.com/excel-programming/354238-error-400-making-row-visible-protected-sheet.html)

[email protected]

Error 400 on making row visible on a protected sheet
 
I have a button which kicks off a VBA method which either hides or
unhides rows on a Worksheet.

I'd like to protect the worksheets but if I do an Error 400 occurs when
the VBA attempts to change a row's status from visible to invisible.

I've tried various protection settings but I still get the same error.

Is there one I should have tried?

Any suggestions? Should I have VBA unprotect/protect the sheet?


Nick Hodge

Error 400 on making row visible on a protected sheet
 
Use the VBA to unprotect the sheet just before unhiding and then protect
again just after

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
www.nickhodge.co.uk
HIS


wrote in message
ups.com...
I have a button which kicks off a VBA method which either hides or
unhides rows on a Worksheet.

I'd like to protect the worksheets but if I do an Error 400 occurs when
the VBA attempts to change a row's status from visible to invisible.

I've tried various protection settings but I still get the same error.

Is there one I should have tried?

Any suggestions? Should I have VBA unprotect/protect the sheet?




dmexcel

Error 400 on making row visible on a protected sheet
 
thats what I would do


Sub Macro1()
'


ActiveSheet.Unprotect
'your code
ActiveSheet.Protect

End Sub


Tom Ogilvy

Error 400 on making row visible on a protected sheet
 
Unprotect the sheet
change the rows
protect the sheet

Look at the Protect and Unprotect methods of the Worksheet object.

--
Regards,
Tom Ogilvy

wrote in message
ups.com...
I have a button which kicks off a VBA method which either hides or
unhides rows on a Worksheet.

I'd like to protect the worksheets but if I do an Error 400 occurs when
the VBA attempts to change a row's status from visible to invisible.

I've tried various protection settings but I still get the same error.

Is there one I should have tried?

Any suggestions? Should I have VBA unprotect/protect the sheet?





All times are GMT +1. The time now is 08:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com