• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

scrollbar hide

kalpeshpatel

New Member
i create a macro to hide scrollbar vetical & horizontal when sheet1 is active but problem is all other sheets scrollbar is hide

why
 
Hi Kalpesh..

DisplayScrollbar is a Property of Application Object and Window Object. Its not a property of Sheets,Worksheet or ActiveWorksheet object. You cant manipulate according to each Worksheet. Just try the below code, It check the property of activeSheet, and according to property you can change


ActiveWindow.DisplayVerticalScrollBar (for current Window/Frames Vertical)

ActiveWindow.DisplayHorizontalScrollBar (for current Window/Frames Horizontal)

Application.DisplayScrollBars (for current Application/EXCEL's, both ScrollBar)


Private Sub Workbook_SheetActivate(ByVal Sh As Object)

If ActiveSheet.Name = "Sheet1" Then

Application.DisplayScrollBars = False

Else

Application.DisplayScrollBars = True

End If

End Sub
 
Back
Top