Code – Adjust Excel Screen to 75% and Set Column A and Row 1 Width to 0.5 inches
Here’s a tutorial on how to use the VBA code to adjust the Excel screen to 75% and set the width of column A and row 1 to 0.5:
- Open Microsoft Excel and press ALT + F11 to open the Visual Basic Editor (VBE).
- In the VBE, select “Insert” from the menu and then select “Module”. This will create a new module where you can paste the VBA code.
- In the new module, paste the following code:
Sub AdjustScreen()
ActiveWindow.Zoom = 75
Columns("A:A").ColumnWidth = 0.5
Rows("1:1").RowHeight = 0.5
End Sub
- Press the “Run” button or press F5 to run the macro. This will adjust the Excel screen to 75% and set the width of column A and row 1 to 0.5 inches.
You can also assign this code to a button, so you can execute it whenever you want.
The first line of the code, ActiveWindow.Zoom = 75
is used to adjust the Excel screen to 75%. The next two lines of code, Columns("A:A").ColumnWidth = 0.5
and Rows("1:1").RowHeight = 0.5
, are used to set the width of column A and row 1 to 0.5 inches respectively.
Please note that the width and height are measured in points and the default column width is 8.43 and the default row height is 15. The above code sets the width of column A to 0.5 inches and the height of row 1 to 0.5 inches.