ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Click event on Scrollbar (https://www.excelbanter.com/excel-programming/272179-click-event-scrollbar.html)

Sam K

Click event on Scrollbar
 
I would like to know how to trigger formatting (text
wrapping)of the visible screen on a worksheet from a mouse
click on the scroll bar or slider in Excel. I did that
using the selectionchange worksheet event in the code that
follows, however it only applies to cell changes and user
sees text unwrapped. I would like the user to avoid seeing
the text in the process of being wrapped. Thanks in
advance, Sam

Public Sub worksheet_selectionchange(ByVal Target As
Excel.Range)
With Application
.ScreenUpdating = False
.EnableEvents = False
Windows(1).VisibleRange.Select
With Selection
.WrapText = True
End With
Target.Select
.EnableEvents = True
.ScreenUpdating = True
End With
End Sub

Harald Staff[_4_]

Click event on Scrollbar
 
What you want is a "window scroll" event. I think you are out of luck on this one. The
only ones available is Activate, Deactivate and Resize, and I can't think of any
workaround trick for this. Hopefully someone can.

--
HTH. Best wishes Harald
Excel MVP

Followup to newsgroup only please.

"Sam K" wrote in message
...
I would like to know how to trigger formatting (text
wrapping)of the visible screen on a worksheet from a mouse
click on the scroll bar or slider in Excel. I did that
using the selectionchange worksheet event in the code that
follows, however it only applies to cell changes and user
sees text unwrapped. I would like the user to avoid seeing
the text in the process of being wrapped. Thanks in
advance, Sam

Public Sub worksheet_selectionchange(ByVal Target As
Excel.Range)
With Application
.ScreenUpdating = False
.EnableEvents = False
Windows(1).VisibleRange.Select
With Selection
.WrapText = True
End With
Target.Select
.EnableEvents = True
.ScreenUpdating = True
End With
End Sub





All times are GMT +1. The time now is 03:42 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com