Livin404
Well-known Member
- Joined
- Jan 7, 2019
- Messages
- 743
- Office Version
- 365
- 2019
- Platform
- Windows
Greetings, I've made a lot of progress on my set print area, using the VBA will help me keep the print area from being compromised. I created a macro that nearly gets me there, but I need it slightly changed. The final product I hope will not have the buttons. the range within the Columns goes from A to H. I provided an image which I hope helps. The near perfect VBA is below. There is data below, I just have it redacted. Thank you,
VBA Code:
Sub Set_Print_Area()
Application.Calculation = xlCalculationManual
Application.EnableEvents = False
Application.ScreenUpdating = False
Dim startCell As Range, lastrow, lastCol As Long, ws As Worksheet
Set ws = Sheet1
Set startCell = Range("A1")
lastrow = ws.Cells(ws.Rows.Count, startCell.Column).End(xlUp).Row
lastCol = ws.Cells(startCell.Row, ws.Columns.Count).End(xlToLeft).Column
ws.Range(startCell, ws.Cells(lastrow, lastCol)).Select
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub