Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Cells.Interior.Color question

I have successfully used the Cells.Interior.Color = X but in certain cases I
want to undo the change. I have tried Cells.Interior.Color = vbWhite but then
the cell border is gone.

Is there a way to set the color back to white (or automatic) and have the
cell borders show back up?

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default Cells.Interior.Color question

Try this

Cells.Interior.ColorIndex = xlNone

Hope this helps! If so, let me know and click "YES" below.
--
Cheers,
Ryan


"extrapulp" wrote:

I have successfully used the Cells.Interior.Color = X but in certain cases I
want to undo the change. I have tried Cells.Interior.Color = vbWhite but then
the cell border is gone.

Is there a way to set the color back to white (or automatic) and have the
cell borders show back up?

Thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Cells.Interior.Color question

hi
instead of vbwhite which is true color, try ...
vbNone
or
xlNone.

both equate to "No Fill".

regards
FSt1

Regards
FSt1

"extrapulp" wrote:

I have successfully used the Cells.Interior.Color = X but in certain cases I
want to undo the change. I have tried Cells.Interior.Color = vbWhite but then
the cell border is gone.

Is there a way to set the color back to white (or automatic) and have the
cell borders show back up?

Thanks

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Cells.Interior.Color question

I have the exact opposite problem. I have a workbook that is protected and I
need jsut the active cells to hightlight yellow so the customer can follow
the form. I applied the following code:

ActiveSheet.Unprotect Password:=€ťxxxxx€ť

'colors active cell yellow with blue outline

Cells.Interior.ColorIndex = xlNone

ActiveCell.Interior.ColorIndex = 27

ActiveSheet.Protect Password:=€ťxxxxx€ť

this worked great and the unprotected cell hightlight yellow and I no longer
got the 1004 error once I added the password code...now the problem I have...

This form has cells that are highlighted with other colors and when the code
about is applied it removes all colors except the active cell. I'm pretty
sure that its because of:

Cells.Interior.ColorIndex = xlNone

but Im not sure what to use so that other fields are not affected...any ideas?

Thanks,

Zina~





"RyanH" wrote:

Try this

Cells.Interior.ColorIndex = xlNone

Hope this helps! If so, let me know and click "YES" below.
--
Cheers,
Ryan


"extrapulp" wrote:

I have successfully used the Cells.Interior.Color = X but in certain cases I
want to undo the change. I have tried Cells.Interior.Color = vbWhite but then
the cell border is gone.

Is there a way to set the color back to white (or automatic) and have the
cell borders show back up?

Thanks

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Cells.Interior.Color question

Zina

Try this version

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Static OldCell As Range
If Application.CutCopyMode = 0 Then
ActiveSheet.Unprotect Password:="justme"
If Not OldCell Is Nothing Then
OldCell.Interior.ColorIndex = xlColorIndexNone
OldCell.Borders.LineStyle = xlLineStyleNone
End If
Set OldCell = Target
OldCell.Interior.ColorIndex = 6
OldCell.Borders.LineStyle = xlContinuous
Else
If OldCell Is Nothing Then
Set OldCell = Target
Else
Set OldCell = Union(OldCell, Target)
End If
End If
ActiveSheet.Protect Password:="justme"
End Sub

Will color the activecell yellow.

Note: will wipe out existing background color of activecell cell unless BG
color is due to CF


Gord Dibben MS Excel MVP

On Thu, 15 Jan 2009 14:08:11 -0800, Zina
wrote:

I have the exact opposite problem. I have a workbook that is protected and I
need jsut the active cells to hightlight yellow so the customer can follow
the form. I applied the following code:

ActiveSheet.Unprotect Password:=”xxxxx”

'colors active cell yellow with blue outline

Cells.Interior.ColorIndex = xlNone

ActiveCell.Interior.ColorIndex = 27

ActiveSheet.Protect Password:=”xxxxx”

this worked great and the unprotected cell hightlight yellow and I no longer
got the 1004 error once I added the password code...now the problem I have...

This form has cells that are highlighted with other colors and when the code
about is applied it removes all colors except the active cell. I'm pretty
sure that its because of:

Cells.Interior.ColorIndex = xlNone

but Im not sure what to use so that other fields are not affected...any ideas?

Thanks,

Zina~





"RyanH" wrote:

Try this

Cells.Interior.ColorIndex = xlNone

Hope this helps! If so, let me know and click "YES" below.
--
Cheers,
Ryan


"extrapulp" wrote:

I have successfully used the Cells.Interior.Color = X but in certain cases I
want to undo the change. I have tried Cells.Interior.Color = vbWhite but then
the cell border is gone.

Is there a way to set the color back to white (or automatic) and have the
cell borders show back up?

Thanks




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Cells.Interior.Color question

H Gord,

That worked great! I do have one slight issue though...its now changing the
lines and borders in the sheet. any way to stop that and have no effect on
those?

THANK SO MUCH FOR YOUR HELP!

Zina~

"Gord Dibben" wrote:

Zina

Try this version

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Static OldCell As Range
If Application.CutCopyMode = 0 Then
ActiveSheet.Unprotect Password:="justme"
If Not OldCell Is Nothing Then
OldCell.Interior.ColorIndex = xlColorIndexNone
OldCell.Borders.LineStyle = xlLineStyleNone
End If
Set OldCell = Target
OldCell.Interior.ColorIndex = 6
OldCell.Borders.LineStyle = xlContinuous
Else
If OldCell Is Nothing Then
Set OldCell = Target
Else
Set OldCell = Union(OldCell, Target)
End If
End If
ActiveSheet.Protect Password:="justme"
End Sub

Will color the activecell yellow.

Note: will wipe out existing background color of activecell cell unless BG
color is due to CF


Gord Dibben MS Excel MVP

On Thu, 15 Jan 2009 14:08:11 -0800, Zina
wrote:

I have the exact opposite problem. I have a workbook that is protected and I
need jsut the active cells to hightlight yellow so the customer can follow
the form. I applied the following code:

ActiveSheet.Unprotect Password:=€ťxxxxx€ť

'colors active cell yellow with blue outline

Cells.Interior.ColorIndex = xlNone

ActiveCell.Interior.ColorIndex = 27

ActiveSheet.Protect Password:=€ťxxxxx€ť

this worked great and the unprotected cell hightlight yellow and I no longer
got the 1004 error once I added the password code...now the problem I have...

This form has cells that are highlighted with other colors and when the code
about is applied it removes all colors except the active cell. I'm pretty
sure that its because of:

Cells.Interior.ColorIndex = xlNone

but Im not sure what to use so that other fields are not affected...any ideas?

Thanks,

Zina~





"RyanH" wrote:

Try this

Cells.Interior.ColorIndex = xlNone

Hope this helps! If so, let me know and click "YES" below.
--
Cheers,
Ryan


"extrapulp" wrote:

I have successfully used the Cells.Interior.Color = X but in certain cases I
want to undo the change. I have tried Cells.Interior.Color = vbWhite but then
the cell border is gone.

Is there a way to set the color back to white (or automatic) and have the
cell borders show back up?

Thanks



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Cells.Interior.Color question

Delete the two lines dealing with oldcell.borders.linestyle

Those were "left-overs"


Gord

On Thu, 15 Jan 2009 17:48:01 -0800, Zina
wrote:

H Gord,

That worked great! I do have one slight issue though...its now changing the
lines and borders in the sheet. any way to stop that and have no effect on
those?

THANK SO MUCH FOR YOUR HELP!

Zina~

"Gord Dibben" wrote:

Zina

Try this version

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Static OldCell As Range
If Application.CutCopyMode = 0 Then
ActiveSheet.Unprotect Password:="justme"
If Not OldCell Is Nothing Then
OldCell.Interior.ColorIndex = xlColorIndexNone
OldCell.Borders.LineStyle = xlLineStyleNone
End If
Set OldCell = Target
OldCell.Interior.ColorIndex = 6
OldCell.Borders.LineStyle = xlContinuous
Else
If OldCell Is Nothing Then
Set OldCell = Target
Else
Set OldCell = Union(OldCell, Target)
End If
End If
ActiveSheet.Protect Password:="justme"
End Sub

Will color the activecell yellow.

Note: will wipe out existing background color of activecell cell unless BG
color is due to CF


Gord Dibben MS Excel MVP

On Thu, 15 Jan 2009 14:08:11 -0800, Zina
wrote:

I have the exact opposite problem. I have a workbook that is protected and I
need jsut the active cells to hightlight yellow so the customer can follow
the form. I applied the following code:

ActiveSheet.Unprotect Password:=”xxxxx”

'colors active cell yellow with blue outline

Cells.Interior.ColorIndex = xlNone

ActiveCell.Interior.ColorIndex = 27

ActiveSheet.Protect Password:=”xxxxx”

this worked great and the unprotected cell hightlight yellow and I no longer
got the 1004 error once I added the password code...now the problem I have...

This form has cells that are highlighted with other colors and when the code
about is applied it removes all colors except the active cell. I'm pretty
sure that its because of:

Cells.Interior.ColorIndex = xlNone

but Im not sure what to use so that other fields are not affected...any ideas?

Thanks,

Zina~





"RyanH" wrote:

Try this

Cells.Interior.ColorIndex = xlNone

Hope this helps! If so, let me know and click "YES" below.
--
Cheers,
Ryan


"extrapulp" wrote:

I have successfully used the Cells.Interior.Color = X but in certain cases I
want to undo the change. I have tried Cells.Interior.Color = vbWhite but then
the cell border is gone.

Is there a way to set the color back to white (or automatic) and have the
cell borders show back up?

Thanks




  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Cells.Interior.Color question

Thanks Gord! Worked like a charm~!

"Gord Dibben" wrote:

Delete the two lines dealing with oldcell.borders.linestyle

Those were "left-overs"


Gord

On Thu, 15 Jan 2009 17:48:01 -0800, Zina
wrote:

H Gord,

That worked great! I do have one slight issue though...its now changing the
lines and borders in the sheet. any way to stop that and have no effect on
those?

THANK SO MUCH FOR YOUR HELP!

Zina~

"Gord Dibben" wrote:

Zina

Try this version

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Static OldCell As Range
If Application.CutCopyMode = 0 Then
ActiveSheet.Unprotect Password:="justme"
If Not OldCell Is Nothing Then
OldCell.Interior.ColorIndex = xlColorIndexNone
OldCell.Borders.LineStyle = xlLineStyleNone
End If
Set OldCell = Target
OldCell.Interior.ColorIndex = 6
OldCell.Borders.LineStyle = xlContinuous
Else
If OldCell Is Nothing Then
Set OldCell = Target
Else
Set OldCell = Union(OldCell, Target)
End If
End If
ActiveSheet.Protect Password:="justme"
End Sub

Will color the activecell yellow.

Note: will wipe out existing background color of activecell cell unless BG
color is due to CF


Gord Dibben MS Excel MVP

On Thu, 15 Jan 2009 14:08:11 -0800, Zina
wrote:

I have the exact opposite problem. I have a workbook that is protected and I
need jsut the active cells to hightlight yellow so the customer can follow
the form. I applied the following code:

ActiveSheet.Unprotect Password:=€ťxxxxx€ť

'colors active cell yellow with blue outline

Cells.Interior.ColorIndex = xlNone

ActiveCell.Interior.ColorIndex = 27

ActiveSheet.Protect Password:=€ťxxxxx€ť

this worked great and the unprotected cell hightlight yellow and I no longer
got the 1004 error once I added the password code...now the problem I have...

This form has cells that are highlighted with other colors and when the code
about is applied it removes all colors except the active cell. I'm pretty
sure that its because of:

Cells.Interior.ColorIndex = xlNone

but Im not sure what to use so that other fields are not affected...any ideas?

Thanks,

Zina~





"RyanH" wrote:

Try this

Cells.Interior.ColorIndex = xlNone

Hope this helps! If so, let me know and click "YES" below.
--
Cheers,
Ryan


"extrapulp" wrote:

I have successfully used the Cells.Interior.Color = X but in certain cases I
want to undo the change. I have tried Cells.Interior.Color = vbWhite but then
the cell border is gone.

Is there a way to set the color back to white (or automatic) and have the
cell borders show back up?

Thanks




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
Sort by Cells Interior Color Then by Date RyanH Excel Programming 3 January 19th 10 05:38 PM
lock cells based on interior color MIke Excel Discussion (Misc queries) 4 December 27th 07 08:59 PM
Quick question Finding a cell by interior color Celt[_43_] Excel Programming 3 April 5th 06 06:40 PM
cells interior/color index tandavina[_7_] Excel Programming 4 February 12th 06 11:28 AM
Sum all cells with interior color... Ctech[_65_] Excel Programming 4 January 11th 06 07:46 PM


All times are GMT +1. The time now is 05:47 PM.

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

About Us

"It's about Microsoft Excel"