Get rid of the error in the workbook_open event, so that 'snap to grid' is enabled by this event Any help greatly appreciated. Identify whether 'snap to grid' is already enabled and just skip the 'command bars execute' code in the worksheet_activate event if it is. To get around this I put the code in the worksheet_activate event, as follows: Private Sub Worksheet_Activate() CommandBars("Drawing").Controls("Draw").Controls("Snap").Controls("To Grid").Execute End Sub This works fine but the problem is that if you switch sheets and then reactivate the sheet with the code, it turns snap to grid off again, so I suspect is it just mimicking the 'click' event on the ribbon. Snap to Shape provides the same behavior. When Snap to Grid is turned on, the edges of the shape will 'snap' to the nearest grid line. Excel proposes features named Snap to Shape and Snap to Grid that can help to organize shape and any objects. This way you can easily snap to the grid using this shortcut. This is useful method way to ensure objects are exactly the same size without enabling the snap to grid setting in Excel. This works both for dragging objects to a new location on the worksheet, as well as resizing objects so that their edges align to the grid. When you use this shortcut you can able to snap objects to the Excel grid, including charts, shapes, smart art, and text boxes. I tried putting the following code in the workbook_open event: CommandBars("Drawing").Controls("Draw").Controls("Snap").Controls("To Grid").Execute However, this generated an error "Object variable or With block variable not set". Every time you add, move, or resize shapes, by default, it isn't easy to align them. It is used to snap to grid in Microsoft Excel. Hi I have an Excel workbook where I want snap to grid enabled automatically when the workbook opens.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |