PDA

View Full Version : [SOLVED] Show Definitions of Named Styles



Cyberdude
08-15-2005, 10:49 AM
Years ago I created a bunch of named styles for use on my Excel worksheets, and now I would like to see a display of all the characteristics that comprise the definition of each style (yes, I forgot how I defined them). I think there are probably some duplicates and near duplicates I'd like to delete, and some I'd like to implement with VBA statements. My question is, can I call up a display of the attributes of a defined style? I've looked at the dialog box I get from FORMAT->STYLE, and that helps, but doesn't detail things like border color, etc.

Ken Puls
08-15-2005, 11:22 AM
Hi Sid!

Quick n dirty, but may get you started...


Sub ListStyles()
Dim stl As Style
On Error Resume Next
For Each stl In ThisWorkbook.Styles
With ActiveSheet.Range("A65536").End(xlUp).Offset(1, 0)
.Value = stl.Name
.Offset(0, 1).Value = stl.Borders
.Offset(0, 2).Value = stl.Font.Name
End With
Next stl
On Error GoTo 0
End Sub

Don't know what you want for borders, but if you have your Intellisense on, go to the line ending "Borders", type . and choose from what comes up.

You can add the rest of the things you're interested in by adding more lines like .offset(0,x).value = stl.whateveryouwanthere

HTH,

Cyberdude
08-15-2005, 01:49 PM
Thanx, Ken. I'll work with it. And what is "Intellisense"??
Sounds like something I want on.

Later...
OK, that's pretty much what I was looking for. I now know what Intellisense is. Use it all the time, but didn't have a name for it. Thanx again.

Ken Puls
08-15-2005, 02:44 PM
LOL! Sorry, Sid.

Intellisense, for anyone else, is a funky way of saying "Auto List Members". Don't ask me how that comes out of it, but I think it's a generally accepted term. It's what allows VBA to suggest the next object/property/method to you when you are typing a line of code. (You hit . and it gives you a list of things you can use next.)

You can turn it on in the VBE by going to Tools|Options|Editor.

:)