Hi all. Having a bit of a problem getting one of my macros to work in excel 2007. I've created a drop down list in 'Front Page' with the number of rows I want to be displayed in a table in another sheet 'Detail No.', but I keep getting [Runtime error 1004: Unable to set the hidden property of range class]. I tried unprotecting my worksheet, but that didn't seem to help (Not that I really want to leave it unprotected anyway). Help would be much appreciated, here is the code at present along with the document:
TEST.xls
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim rowNum As Long, offsetVal As Long
If Not Application.Intersect(Target, Range("G6")) Is Nothing Then
offsetVal = Application.Max(0, Val(Range("G6").Text))
For rowNum = 2 To 21
Sheets(2).Rows(rowNum).Hidden = (1 < rowNum - offsetVal)
Next rowNum
End If
End Sub
Thanks
Loobrush
Bookmarks