Colour numbers

  • Thread starter Thread starter MAX
  • Start date Start date
M

MAX

I am trying to get some colour numbers so that I will use them in codes. I am
using Excel 2007 and I tried to get the number of the red colour by record a
macro then I look in module. So for red it gives me number 255. When I
inserted in code, it didn't work. Just to tell you that in Excel 2003 it
gives me number 3, and it worked.
The problem is that I have Excel 2007. Any help please?

Thanks a lot
 
Try this
Range("A1").Interior.Color = vbRed

vbCyan/vbGreen/vbBlue/vbYellow

If this post helps click Yes
 
From VBE window, tree view. Double click 'This Workbook' and drop down to get
the below event.. It will ask for a confirmation when you select R2

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target
As Range)
If Target.Address = Range("R2").Address Then
If MsgBox("Do you want to rotate", vbYesNo + vbDefaultButton2) <> _
vbYes Then Exit Sub

'<paste your code here>

End If
End Sub


If this post helps click Yes
 
Sub ListColorIndexes()
Dim Ndx As Long
Sheets.Add
For Ndx = 1 To 56
Cells(Ndx, 1).Interior.ColorIndex = Ndx
Cells(Ndx, 2).Value = Hex(ThisWorkbook.Colors(Ndx))
Cells(Ndx, 3).Value = Ndx
Next Ndx
End Sub


Gord Dibben MS Excel MVP
 
Back
Top