ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Cell Colour (https://www.excelbanter.com/excel-programming/318016-cell-colour.html)

Ibrahim Awwad[_2_]

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

Rob van Gelder[_4_]

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




Frank Kabel

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


Ibrahim Awwad[_2_]

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


Frank Kabel

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


Ibrahim Awwad[_2_]

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


Bob Phillips[_6_]

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





All times are GMT +1. The time now is 02:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com