Hi,
I am trying to hide rows which I have named as a range "NumberNights". I have managed to do this successfully except that within these rows is a scroll bar which is not being hidden with the rows. I have tried naming the scroll bar as another range "avgcostnightscrollbar". I gather from previous posts that I have to hide the entire row that the scroll bar is on (which is fine - if it is one of the rows I am trying to hide anyway). My code is as follows (for which I am getting an error on the 6th line):
Private Sub TotalExpend_Click()
If TotalExpend.Value = True Then
Range("OtherHolidayChoice").Value = 1
Range("TotalExpenditure").EntireRow.Hidden = False
Range("NumberNights").EntireRow.Hidden = True
Range("avgcostnightscrollbar").EntireRow.Hidden = True
End If
End Sub
I have tried putting in Sheet name, Object instead of Range etc, but can't get anything to work. Can anyone help me with the correct syntax?
Thanks.
I am trying to hide rows which I have named as a range "NumberNights". I have managed to do this successfully except that within these rows is a scroll bar which is not being hidden with the rows. I have tried naming the scroll bar as another range "avgcostnightscrollbar". I gather from previous posts that I have to hide the entire row that the scroll bar is on (which is fine - if it is one of the rows I am trying to hide anyway). My code is as follows (for which I am getting an error on the 6th line):
Private Sub TotalExpend_Click()
If TotalExpend.Value = True Then
Range("OtherHolidayChoice").Value = 1
Range("TotalExpenditure").EntireRow.Hidden = False
Range("NumberNights").EntireRow.Hidden = True
Range("avgcostnightscrollbar").EntireRow.Hidden = True
End If
End Sub
I have tried putting in Sheet name, Object instead of Range etc, but can't get anything to work. Can anyone help me with the correct syntax?
Thanks.