Hi All – </SPAN></SPAN>
I’m hoping you can help correct this problem. I have a large workbook that will be delivered to several hundred users and requires many data entry fields, meaning the workbook and each of its worksheets need to be protected. On one of the worksheets, users of Excel 2007 are running into the following run-time error: “Unable to set hidden property of the range class”. I need this to be fixed so that Excel 2007 & 2003 users won’t run into this problem.</SPAN></SPAN>
What: I have two form control option buttons (option button 30 & 31) that the user selects. Each button corresponds to a set of rows where the user is instructed to input additional information. The idea is that when one button is selected, only the rows of pertinent info displays and hides the rows that aren’t needed. More specifically, when option button 30 is selected, rows 41 through 48 should be hidden. When option button 31 is selected, rows 41 through 48 should be displayed.</SPAN></SPAN>
How: Here is the code I’m using. I wrote this on a PC using Excel 2010. The cell “X12” is the linked cell.</SPAN></SPAN>
I’m hoping you can help correct this problem. I have a large workbook that will be delivered to several hundred users and requires many data entry fields, meaning the workbook and each of its worksheets need to be protected. On one of the worksheets, users of Excel 2007 are running into the following run-time error: “Unable to set hidden property of the range class”. I need this to be fixed so that Excel 2007 & 2003 users won’t run into this problem.</SPAN></SPAN>
What: I have two form control option buttons (option button 30 & 31) that the user selects. Each button corresponds to a set of rows where the user is instructed to input additional information. The idea is that when one button is selected, only the rows of pertinent info displays and hides the rows that aren’t needed. More specifically, when option button 30 is selected, rows 41 through 48 should be hidden. When option button 31 is selected, rows 41 through 48 should be displayed.</SPAN></SPAN>
How: Here is the code I’m using. I wrote this on a PC using Excel 2010. The cell “X12” is the linked cell.</SPAN></SPAN>
Code:
</SPAN></SPAN>
Sub OptionButton30_Click()</SPAN></SPAN>
If Range("X12").Value = 1 Then</SPAN></SPAN>
Rows("41:48").Select</SPAN></SPAN>
Selection.EntireRow.Hidden = True</SPAN></SPAN>
Else</SPAN></SPAN>
Rows("41:48").Select</SPAN></SPAN>
Selection.EntireRow.Hidden = False</SPAN></SPAN>
End If</SPAN></SPAN>
Range("D16").Select</SPAN></SPAN>
End Sub</SPAN></SPAN>
Sub OptionButton31_Click()</SPAN></SPAN>
If Range("X12").Value = 2 Then</SPAN></SPAN>
Rows("41:48").Select</SPAN></SPAN>
Selection.EntireRow.Hidden = False</SPAN></SPAN>
Else</SPAN></SPAN>
Rows("41:48").Select</SPAN></SPAN>
Selection.EntireRow.Hidden = True</SPAN></SPAN>
End If</SPAN></SPAN>
Range("D16").Select</SPAN></SPAN>
End Sub</SPAN></SPAN>
[/endcode]</SPAN></SPAN>
Why: I want to make this usable for users of Excel 2007 and 2003, however users of 2007 are getting the run-time error: “Unable to set hidden property of the range class” as stated above. It works fine in 2010 and I can’t re-produce the error myself. </SPAN></SPAN>
I’m hoping this will be a simple solution for you excel gurus! Any ideas?!</SPAN></SPAN>
Thanks!</SPAN></SPAN>