Analyze Formatting?

Macropheliac

Board Regular
Joined
Aug 26, 2005
Messages
165
Hello,
This may be impossible, but I thought I'd ask.
Is it possible to return the formatting of a cell in text or code?
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
What format ? the number format ?

MsgBox Range("A1").NumberFormat

the background color ?

MsgBox Range("A1").Interior.ColorIndex

font ?

MsgBox Range("A1").Font.Name
 
Upvote 0
Thanks Juan.

This is exactly what I needed.

Thanks to you, as well, PA HS Teacher.
I find this link very helpful.

Once again, thanks to you both.
 
Upvote 0
I was going to suggest this:
Code:
Sub GetFormat()
Dim msg As String

msg = vbNullString

    With Selection
        msg = "Number Format = " & .NumberFormat & vbCrLf
        msg = msg & "Horizontal Alignment = " & .HorizontalAlignment & vbCrLf
        msg = msg & "Vertical Alignment = " & .VerticalAlignment & vbCrLf
        msg = msg & "Wrap Text = " & .WrapText & vbCrLf
        msg = msg & "Orientation = " & .Orientation = 0 & vbCrLf
        msg = msg & "Add Indent = " & .AddIndent & vbCrLf
        msg = msg & "Indent Level = " & .IndentLevel & vbCrLf
        msg = msg & "Shrink to fit = " & .ShrinkToFit & vbCrLf
        msg = msg & "Reading Order = " & .ReadingOrder & vbCrLf
        msg = msg & "Merge Cells = " & .MergeCells
    End With
    
    MsgBox msg
End Sub
But after seeing PA HS Teacher's response I'm very surprised there was code to do all of that!

Good stuff PA HS Teacher!
 
Upvote 0

Forum statistics

Threads
1,212,046
Messages
6,105,586
Members
447,972
Latest member
carrieann

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