How to get all formatting back from a cell in Excel using VBA?

How can I use VBA to return all formatting information about a cell in Excel. For example:

purple struck through text followed by regular green text

I need to know which text is purple, green, and which is breaking through. Range("B2").Value

only returns plain text. I also need formatting.

+3


source to share


1 answer


it is best to use Intellisense to explore all the values โ€‹โ€‹available to you. You can complete the code snippet below, with such things as .Color

, .Strikethrough

, .Bold

etc and print them out the nearest window. (Ctrl + G displays the immediate window if it is not currently displayed)

Sub test()
debug.Print Range("B1").Font 'finish this line with any of the IntelliSense options to learn things about the text
End Sub

      



You can also look at the properties listed on the MDSN site for the font object

+1


source







All Articles