Consulting

Results 1 to 4 of 4

Thread: Show Definitions of Named Styles

  1. #1

    Show Definitions of Named Styles

    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.

  2. #2
    Moderator VBAX Guru Ken Puls's Avatar
    Joined
    Aug 2004
    Location
    Nanaimo, BC, Canada
    Posts
    4,001
    Location
    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,
    Ken Puls, CMA - Microsoft MVP (Excel)
    I hate it when my computer does what I tell it to, and not what I want it to.

    Learn how to use our KB tags! -||- Ken's Excel Website -||- Ken's Excel Forums -||- My Blog -||- Excel Training Calendar

    This is a shameless plug for my new book "RibbonX - Customizing the Office 2007 Ribbon". Find out more about it here!

    Help keep VBAX clean! Use the 'Thread Tools' menu to mark your own threads solved!





  3. #3
    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.

  4. #4
    Moderator VBAX Guru Ken Puls's Avatar
    Joined
    Aug 2004
    Location
    Nanaimo, BC, Canada
    Posts
    4,001
    Location
    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.

    Ken Puls, CMA - Microsoft MVP (Excel)
    I hate it when my computer does what I tell it to, and not what I want it to.

    Learn how to use our KB tags! -||- Ken's Excel Website -||- Ken's Excel Forums -||- My Blog -||- Excel Training Calendar

    This is a shameless plug for my new book "RibbonX - Customizing the Office 2007 Ribbon". Find out more about it here!

    Help keep VBAX clean! Use the 'Thread Tools' menu to mark your own threads solved!





Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •