JBriceland13
New Member
- Joined
- Oct 24, 2018
- Messages
- 3
Below is a Macro that deletes everything outside of the print area and changes all font to a specific grey I need to change to. Only problem is some sheets have white font in them that I need to remain white. Does anyone know how to alter the last part of this Macro to be something such as: If font= RGB (0,0,0) remains RGB (0,0,0), Else change to RGB (69, 85, 96)
Thanks for the help! See below:
Thanks for the help! See below:
Rich (BB code):
Sub DeleteOutsidePrintableArea()
Dim PrintRange As Range
Dim Range_Top As Integer
Dim Range_Left As Integer
Dim Range_Bottom As Integer
Dim Range_Right As Integer
ScreenUpdating = False
Set PrintRange = Range(ActiveSheet.PageSetup.PrintArea)
Range_Top = PrintRange.Row
Range_Left = PrintRange.Column
Range_Bottom = PrintRange.Rows(PrintRange.Rows.Count).Row
Range_Right = PrintRange.Columns(PrintRange.Columns.Count).Column
'delete from the bottom row down first.
If Range_Bottom < 65535 Then
ActiveSheet.Range(Range_Bottom + 1 & ":65536").Delete
End If
'delete from the top row up.
If Range_Top > 1 Then
ActiveSheet.Range("1:" & Range_Top - 1).Delete
End If
'delete from the right hand side next.
If Range_Right < 255 Then
ActiveSheet.Range(ActiveSheet.Columns(Range_Right + 1), ActiveSheet.Columns(256)).Delete
End If
'lastly delete from the left hand side.
If Range_Left > 1 Then
ActiveSheet.Range(ActiveSheet.Columns(Range_Left - 1), ActiveSheet.Columns(1)).Delete
End If
Range(ActiveSheet.PageSetup.PrintArea).Font.Color = RGB (69, 85, 96)
ScreenUpdating = True
End Sub
Last edited by a moderator: