Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 390
Default Colour numbers

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Colour numbers

Review this post.

http://www.mvps.org/dmcritchie/excel/colors.htm

If this post helps click Yes
---------------
Jacob Skaria


"MAX" wrote:

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Colour numbers

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

vbCyan/vbGreen/vbBlue/vbYellow

If this post helps click Yes
---------------
Jacob Skaria


"MAX" wrote:

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Colour numbers

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
---------------
Jacob Skaria


"Jacob Skaria" wrote:

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

vbCyan/vbGreen/vbBlue/vbYellow

If this post helps click Yes
---------------
Jacob Skaria


"MAX" wrote:

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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Colour numbers

Sorry MAX. The below is a wrong post.....Hope you have worked out the colors
--
If this post helps click Yes
---------------
Jacob Skaria


"Jacob Skaria" wrote:

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
---------------
Jacob Skaria


"Jacob Skaria" wrote:

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

vbCyan/vbGreen/vbBlue/vbYellow

If this post helps click Yes
---------------
Jacob Skaria


"MAX" wrote:

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



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Colour numbers

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

On Wed, 6 May 2009 00:19:01 -0700, MAX
wrote:

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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
colour numbers jkf[_3_] Excel Worksheet Functions 2 March 25th 11 10:08 PM
colour cells, same numbers different worksheets geenie Excel Worksheet Functions 1 January 23rd 10 01:38 PM
Font colour numbers JC Excel Discussion (Misc queries) 2 October 7th 06 01:14 PM
How to add numbers in a column dependant on their colour 24 Jan 05 Excel Worksheet Functions 2 August 3rd 05 12:37 PM
Colour cells with dupilate numbers Simon[_11_] Excel Programming 2 November 5th 03 02:34 PM


All times are GMT +1. The time now is 08:12 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"