#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Cell Colour

Dear All,

Can any one tell me how to change the colour of selected cell.

BR
--
*********
IT Manager
DeLaval Ltd.
Cairo-Egypt
*********
|-----------------------------|
|Islam is peace not Terror|
|-----------------------------|
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Cell Colour

Manually:
From the Format menu, select Cells
From the Pattern tab, select a colour
Click OK.

Example in VBA:
Sub test()
Range("A1").Interior.Color = vbRed
Range("B1").Interior.Color = RGB(255, 128, 255)
End Sub

You could try recording those manual steps using the macro recorder.


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Ibrahim Awwad" <ibrahim_awwad(at)hotmail(dot)com(antispam) wrote in
message ...
Dear All,

Can any one tell me how to change the colour of selected cell.

BR
--
*********
IT Manager
DeLaval Ltd.
Cairo-Egypt
*********
|-----------------------------|
|Islam is peace not Terror|
|-----------------------------|



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Cell Colour

Hi
activecell.interior.colorindex=3


"Ibrahim Awwad" wrote:

Dear All,

Can any one tell me how to change the colour of selected cell.

BR
--
*********
IT Manager
DeLaval Ltd.
Cairo-Egypt
*********
|-----------------------------|
|Islam is peace not Terror|
|-----------------------------|

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Cell Colour

Dear Frank,

Well you got my question in a correct way as I need to change the color
of active cell. But I tried to put the statement you sent to me in the VB
Editor and I saved it with one of the sheets of the workbook. But nothing has
worked....
The colors aren't changing at all.
......


"Frank Kabel" wrote:

Hi
activecell.interior.colorindex=3


"Ibrahim Awwad" wrote:

Dear All,

Can any one tell me how to change the colour of selected cell.

BR
--
*********
IT Manager
DeLaval Ltd.
Cairo-Egypt
*********
|-----------------------------|
|Islam is peace not Terror|
|-----------------------------|

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Cell Colour

Hi
do you need this to happen automaically. That is if you change the active
cell this cell should be highlighted?. If yes see:
http://cpearson.com/excel/RowLiner.htm

"Ibrahim Awwad" wrote:

Dear Frank,

Well you got my question in a correct way as I need to change the color
of active cell. But I tried to put the statement you sent to me in the VB
Editor and I saved it with one of the sheets of the workbook. But nothing has
worked....
The colors aren't changing at all.
.....


"Frank Kabel" wrote:

Hi
activecell.interior.colorindex=3


"Ibrahim Awwad" wrote:

Dear All,

Can any one tell me how to change the colour of selected cell.

BR
--
*********
IT Manager
DeLaval Ltd.
Cairo-Egypt
*********
|-----------------------------|
|Islam is peace not Terror|
|-----------------------------|



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Cell Colour

Dear Frank,

Thanks for the link but I thought that there's something easier instead of
add on.

Best Regards

"Frank Kabel" wrote:

Hi
do you need this to happen automaically. That is if you change the active
cell this cell should be highlighted?. If yes see:
http://cpearson.com/excel/RowLiner.htm

"Ibrahim Awwad" wrote:

Dear Frank,

Well you got my question in a correct way as I need to change the color
of active cell. But I tried to put the statement you sent to me in the VB
Editor and I saved it with one of the sheets of the workbook. But nothing has
worked....
The colors aren't changing at all.
.....


"Frank Kabel" wrote:

Hi
activecell.interior.colorindex=3


"Ibrahim Awwad" wrote:

Dear All,

Can any one tell me how to change the colour of selected cell.

BR
--
*********
IT Manager
DeLaval Ltd.
Cairo-Egypt
*********
|-----------------------------|
|Islam is peace not Terror|
|-----------------------------|

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Cell Colour

Ibrahim,

This is what I use

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Cells.FormatConditions.Delete
With Target.EntireRow
.FormatConditions.Add Type:=xlExpression, Formula1:="TRUE"
With .FormatConditions(1)
With .Borders(xlTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 5
End With
With .Borders(xlBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 5
End With
End With
.FormatConditions(1).Interior.ColorIndex = 20
End With

End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.




--

HTH

RP
(remove nothere from the email address if mailing direct)


"Ibrahim Awwad" <ibrahim_awwad(at)hotmail(dot)com(antispam) wrote in
message ...
Dear Frank,

Thanks for the link but I thought that there's something easier instead

of
add on.

Best Regards

"Frank Kabel" wrote:

Hi
do you need this to happen automaically. That is if you change the

active
cell this cell should be highlighted?. If yes see:
http://cpearson.com/excel/RowLiner.htm

"Ibrahim Awwad" wrote:

Dear Frank,

Well you got my question in a correct way as I need to change the

color
of active cell. But I tried to put the statement you sent to me in the

VB
Editor and I saved it with one of the sheets of the workbook. But

nothing has
worked....
The colors aren't changing at all.
.....


"Frank Kabel" wrote:

Hi
activecell.interior.colorindex=3


"Ibrahim Awwad" wrote:

Dear All,

Can any one tell me how to change the colour of selected cell.

BR
--
*********
IT Manager
DeLaval Ltd.
Cairo-Egypt
*********
|-----------------------------|
|Islam is peace not Terror|
|-----------------------------|



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
textBox font colour the same as cell font colour???????? Sophie Excel Discussion (Misc queries) 4 February 13th 09 10:15 AM
How can colour of cell shading be fixed to one colour Tabrez Excel Discussion (Misc queries) 2 September 23rd 08 04:55 PM
change a cell background colour to my own RGB colour requirements Stephen Doughty Excel Discussion (Misc queries) 4 June 16th 06 01:08 PM
How can i change cell colour depending on month of date in cell? andy75 Excel Discussion (Misc queries) 2 January 6th 06 07:46 AM
Conditional Format with VBA - Interior Colour of cell based on value from in-cell dropdown Steve[_52_] Excel Programming 5 June 15th 04 11:45 AM


All times are GMT +1. The time now is 02:58 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"