Macro Change Font Question

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:
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:

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Besides white and black, what other colors could the font within the print area be?
 
Upvote 0
The font can be any color, colleagues will make edits to certain models with whatever color they are accustomed to in order to know what changes will be made. Upon completion, we client ready the models by changing all the font to Grey (RGB: 69,85,96), however this is time consuming to do throughout an entire model and the real issue is on some pages, the font white (0,0,0) needs to remain white.

Really just need to find a solution that: Anything RGB (0,0,0), remains RGB (0,0,0) and change everything else to RGB (69,85,96).

Have been trying to do this with different arguments and if statements, but am coming up empty handed.

Thanks for getting back!

Sincerely,

Jordan
 
Upvote 0
...and the real issue is on some pages...
Okay, so you have to change the non-white font colors on each sheet in the workbook, correct?



...on some pages, the font white (0,0,0) needs to remain white.
Can you tell us what the name of those sheets are?

Are the white fonts only in certain columns or ranges? If so, can you tell us which ones? Also, do these columns or ranges contain only white fonts or could there be a mix of white and non-white fonts within them?
 
Upvote 0
Hey Rick,

Thanks for getting back!

Yes sir, just need to change everything besides white font to the blue-grey (RGB: 69,85,96).

Its really just the active sheet and then I can click to the next one and apply the macro etc...

The white fonts are usually in certain rows, but varies when someone adds or subtracts to their worksheet. And yes there can be a mix sometimes.

I didnt want it to be too hard to figure out, just wanted to keep it simple and know if there was a change everything besides white (0,0,0) to blue-grey (
69,85,96)

Sincerely,

Jordan
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,155
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top