Consulting

Results 1 to 6 of 6

Thread: Colours

  1. #1

    Colours

    Can someone please help. I have a spreadsheet which has a macro in it which runs great but the problem i have is that i need certain colours and can only find 16 QB colours and the codes for the RBG colours dont seem to work. I have attached the colours. Does anyone has any suggestions on where to find them.

    Cheers
    Gordon

  2. #2
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Hi Gordon,
    Please see post #9 of your original thread:
    http://www.vbaexpress.com/forum/showthread.php?t=9852
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  3. #3
    VBAX Tutor Erdin? E. Ka's Avatar
    Joined
    Sep 2006
    Location
    Bursa
    Posts
    264
    Location
    Hi Gordon,

    Try this codes:

    [VBA]
    Sub ColorIndex()
    Dim i As Byte

    For i = 1 To 9
    Cells(i + 1, 4) = Cells(i + 1, 1).Interior.ColorIndex
    Next i

    End Sub
    [/VBA]
    Erdin? E. Kara?am | Loves from Bursa city in Republic of T?rkiye

  4. #4
    Thanks Erdinc, im not good at writing macros, could please write the one for number 3 and then i could copy it for the rest and where do i get the colours from.

    Cheers

    Gordon

  5. #5
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Gordon,
    See attached which is your posted file from post#1 with Erdin? E. Ka's code placed in a standard module.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  6. #6
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    [VBA]Sub AvailableColours()
    For i = 0 To 56
    Cells(i + 1, 1) = i
    Cells(i + 1, 2).Interior.ColorIndex = i
    Next
    End Sub
    [/VBA]
    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'

Posting Permissions

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