Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 05-10-2018, 10:30 PM
jolivanes jolivanes is offline Is there an easier way? Windows 10 Is there an easier way? Office 2013
Advanced Beginner
 
Join Date: Sep 2011
Posts: 91
jolivanes will become famous soon enough
Default

If need be, you can get the RGB values with this.
Select a colored cell and run this code. Use this in the "Maybe_With_RGB()" macro
Code:
Sub ShowColour()
    Dim RGBColour As String, R As Integer, G As Integer, B As Integer, c As Range
        RGBColour = Right("000000" & Hex(Selection.Interior.Color), 6)
            R = WorksheetFunction.Hex2Dec(Right(RGBColour, 2))
            G = WorksheetFunction.Hex2Dec(Mid(RGBColour, 3, 2))
            B = WorksheetFunction.Hex2Dec(Left(RGBColour, 2))
        MsgBox "RGB(" & R & ", " & G & ", " & B & ")"
End Sub
Code to fill with numbers
Code:
Sub Maybe_With_RGB()
Dim c As Range
For Each c In Range("A1:D12")    '<----- Change to actual used colored range
    With c
        Select Case .Interior.Color
            Case Is = RGB(255, 0, 0)    '<----- Change to what you get for Red
                c.Value = -1
                    Case Is = RGB(0, 255, 0)    '<----- Change to what you get for Green
                        c.Value = 1
                    Case Is = RGB(255, 255, 0)    '<----- Change to what you get for Yellow
                c.Value = 0
            Case Else
        End Select
    End With
Next c
End Sub
Reply With Quote
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help making invoices easier wbowles Office 0 07-17-2013 10:39 AM
Is there an easier way? Please help me with an easier solution! Inquisitor Word 1 06-26-2011 01:01 AM
Easier highlighting? atarei Word 0 08-27-2010 05:28 PM
Microsoft Word Easier Navigation Question xxlegendxx Word 0 03-22-2009 07:44 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:24 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft