Consulting

Results 1 to 5 of 5

Thread: Load colours from another sheet

  1. #1

    Load colours from another sheet

    Hi all,

    Does anyone know a bit of code that will load the colours of another excel sheet from a defined path
    eg. i:ex/ex...

  2. #2
    Knowledge Base Approver VBAX Guru GTO's Avatar
    Joined
    Sep 2008
    Posts
    3,368
    Location
    Quote Originally Posted by enfantter
    Hi all,

    Does anyone know a bit of code that will load the colours of another excel sheet from a defined path
    eg. i:ex/ex...
    Greetings,

    Maybe just tired, but I think a bit more info needed. What do you mean by "load" the colors? Are you wanting code to grab colors from a given range in another workbook and replicate the layout in sheet whatever of ThisWorkbook, or build an array of color vals, or???

    Mark

  3. #3
    Cheers,

    What i'm trying to do is to get the colour scheme defined in another book.
    Tools > options > Color > copy colors from

    Alternatively i would like to make a code that redefines the color scheme in excel

    Is this better?

  4. #4
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    What version of Excel?
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  5. #5
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,875
    A one liner might do it:[vba]ThisWorkbook.Colors = Workbooks.Open("C:\Documents and Settings\Someone\My Documents\Logging.xls").Colors[/vba] but will leave open the workbook you're grabbing the colours from, so this might be a bit better:[vba]Application.ScreenUpdating = False
    Set wb = Workbooks.Open("C:\Documents and Settings\Someone\My Documents\Logging.xls")
    ThisWorkbook.Colors = wb.Colors
    wb.Close False
    Application.ScreenUpdating = True[/vba]
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

Posting Permissions

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