![]() ![]() With VBA it is possible to reverse these settings when used within Excel. By default the wheel will scroll up and down the page, but with Ctrl + mouse scroll will zoom into an Excel worksheet. Virtually every mouse has a scroll wheel, or similar scrolling feature. ZoomSetting = Windows("Book1.xlsx").Zoom Change the zoom functions of the mouse scroll wheel ZoomSetting = ActiveWindow.Zoom 'Setting variable to zoom setting of any named window Dim zoomSetting As Integer 'Setting variable to zoom setting of active window Dim zoomSetting As Integer The zoom setting can be assigned to a variable for use at a later point in the code. 'Zoom to selectionĪctiveWindow.Zoom = True Transferring current zoom setting to a variable The code below selects Cells A1:J15, the and zooms the window to the size of those cells. The Zoom to Selection / Fit to Selection feature can be controlled with VBA, however it does require a range to be selected. This option is also available within the Zoom window. Zoom to SelectionĮxcel contains a setting called Zoom to Selection, which is in the View Ribbon.Ĭlicking this button will automatically zoom the active worksheet to fit the selected cells. The minimum and maximum zoom settings permitted are 10% and 400%. 'Change worksheet zoom setting for the active windowĪctiveWindow.Zoom = 56 'Change worksheet zoom setting for any open window If the value set by VBA contains decimal places it will be rounded down to the nearest whole number. The worksheet zoom setting in Excel will always be an integer. Each of these serves different purposes and used at different points, but they can all be controlled by VBA. Excel has zoom settings for worksheets, UserForms and print settings.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |