Switching to Excel 2013 from Excel 2010,
When Sheet2 is inactive
The code
Worksheets("Sheet2").Rows("432:432").EntireRow.Hidden = False
gives Error
Unable to set the Hidden property of the Range class
But works fine when Sheet2 is the Active Sheet
In Excel 2010 , VBA had no problem hiding rows in InactiveSheets .
Is this a change in Excel 2013. If so, any fix.
EDIT:
Worksheets("Sheet2").Protect Password:="password", userinterfaceonly:=True
Worksheets("Sheet2").Rows("2:2").EntireRow.Hidden = False
When setting userinterfaceonly option to true, VBA Code to hide row only works when the sheet is active
I can't recreate this error on a new 2013 Worksheet. But only when opening 2010 Excel app in 2013. Wonder If I am playing with any Settings here.
1004
error by protectingSheet2
, great suggestion @DavidZemens! Of course, you can clear this by usingWorksheet.Unprotect Password:="da_password"
, noting that there may not be a password (in which case you can simply use the.Unprotect
method – Dan Wagner