Type Mismatch Error With Font Name

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
4,562
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Rich (BB code):
        With .Range("AP2:AX2")
            Application.DisplayAlerts = False
            .Merge
            Application.DisplayAlerts = True
            With .Borders
                .LineStyle = xlContinuous
                .Weight = xlThin
                .Color = vbWhite
            End With
            .Interior.Color = RGB(211, 6, 6)
            .Value = st_cd & "   " & Chr(208)
            .Characters(Len(.Value), 1).Font.Name = "Webdings"
        End With

This code formats a range of cells (AP2:AX2), assigns a value (string + a couple spaces + special character).
The majority of the text is in it's native font, but the last character assumes the Webdings font.

I am getting a "Type mismatch error" with the line in red, specifically with the font name. I have used this similar line of code throughout my application with no issue, but in this particular case, it errs.
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
you can't get the length of the .Value property of the entire range all at once. You would need to loop through each cell in the range ("AP2:AX2")

Like you can't say Len(.Range("AP2:AX2").Value) that doesn't make sense... you know?
 
Upvote 0
Oh ... I see. That line of code can only apply to a cell, not a range.
Thank you svendiamond!
 
Upvote 0

Forum statistics

Threads
1,213,556
Messages
6,114,284
Members
448,562
Latest member
Flashbond

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