Font Formatting Not Working

reberryjr

Well-known Member
Joined
Mar 16, 2017
Messages
714
Office Version
  1. 365
Platform
  1. Windows
Can someone tell me why the font formatting isn't working? There is data in row 1 and row 2, but the font type and size are not changing when I activate the worksheet.

Code:
Private Sub Worksheet_Activate()

Application.ScreenUpdating = False


Dim csws6, csws7 As Worksheet
Dim csLastRow7 As Long


Set csws6 = ThisWorkbook.Sheets("Pymt Tracker")
Set csws7 = ThisWorkbook.Sheets("Financials")
csLastRow7 = csws7.Range("D" & Rows.Count).End(xlUp).Row


If csws7.Range("CB" & csLastRow7).Value = "Pymt Status" Then
    Exit Sub
Else
If csws7.Range("CB" & csLastRow7).Value = "Current" Then
Call GetFinancialDetails
    Exit Sub
Else
If Not csws7.Range("CB" & csLastRow7).Value = "Current" Then
    csws7.Range("A" & csLastRow7 & ":CB" & csLastRow7).Copy
    csws7.Range("A" & csLastRow7 + 1).PasteSpecial
    csws7.Range("X" & csLastRow7 + 1).Value = ""
    csws7.Range("AH" & csLastRow7 + 1).Value = ""
    csws7.Range("AR" & csLastRow7 + 1).Value = ""
    csws7.Range("BB" & csLastRow7 + 1).Value = ""
    csws7.Range("BL" & csLastRow7 + 1).Value = ""
    csws7.Range("BT" & csLastRow7 + 1).Value = 0
    csws7.Range("BU" & csLastRow7 + 1).Value = 0
    csws7.Range("BV" & csLastRow7 + 1).Value = 0
    csws7.Range("BW" & csLastRow7 + 1).Value = 0
    csws7.Range("BX" & csLastRow7 + 1).Value = 0


    csws6.Activate
    csws7.Activate
End If
End If
End If
Call GetFinancialDetails
Application.CutCopyMode = False


[COLOR=#ff0000]With UsedRange.Cells[/COLOR]
[COLOR=#ff0000]    .HorizontalAlignment = xlCenter[/COLOR]
[COLOR=#ff0000]    .Borders.LineStyle = xlContinuous[/COLOR]
[COLOR=#ff0000]    With .Font[/COLOR]
[COLOR=#ff0000]        .Name = "Calibri"[/COLOR]
[COLOR=#ff0000]        .Size = 10[/COLOR]
[COLOR=#ff0000]    End With[/COLOR]
[COLOR=#ff0000]    .EntireColumn.AutoFit[/COLOR]
[COLOR=#ff0000]End With[/COLOR]


Application.ScreenUpdating = True


End Sub
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Try changing

Code:
[COLOR=#FF0000]With UsedRange.Cells[/COLOR]

to

Code:
[COLOR=#FF0000]With ActiveSheet.UsedRange.Cells[/COLOR]
 
Upvote 0
I just tried that, and no success. I moved the code up in the procedure, which worked.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,194
Members
453,021
Latest member
pingpong7117

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