Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default change the background's color for current cell

I'm looking for a macro that marks the current cell in worksheet. It has to
be a dynamic function (for any move the current cell will be mark). I want
that the cell will be colored.
Is there a built-in option for that? If yes how can I defined it?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default change the background's color for current cell

Hi
Put this code in the code module behind the sheet where you want to
colour cells.

Option Explicit
Dim lastCell As Range

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Target.Interior.ColorIndex = 6
On Error Resume Next
lastCell.Interior.ColorIndex = xlColorIndexNone
Set lastCell = Target
End Sub

(To see this code module, open the visual basic editor, identify the
sheet in the explorer pane and double click it)

regards
Paul

On Apr 11, 7:48*am, moshe_xls
wrote:
I'm looking for a macro that marks the current cell in worksheet. It has to
be a dynamic function (for any move the current cell will be mark). I want
that the cell will be colored.
Is there a built-in option for that? If yes how can I defined it? *


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default change the background's color for current cell

Thank you Paul for your replay,

I insert the code as a macro and didn't get anything €“ how can I make it run?
My be I didn't make my self clear - I want this program to be run
automatically for any cell I will chose (I couldn't understand if it's in the
code).

Best regards,
Moshe

" wrote:

Hi
Put this code in the code module behind the sheet where you want to
colour cells.

Option Explicit
Dim lastCell As Range

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Target.Interior.ColorIndex = 6
On Error Resume Next
lastCell.Interior.ColorIndex = xlColorIndexNone
Set lastCell = Target
End Sub

(To see this code module, open the visual basic editor, identify the
sheet in the explorer pane and double click it)

regards
Paul

On Apr 11, 7:48 am, moshe_xls
wrote:
I'm looking for a macro that marks the current cell in worksheet. It has to
be a dynamic function (for any move the current cell will be mark). I want
that the cell will be colored.
Is there a built-in option for that? If yes how can I defined it?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default change the background's color for current cell

Hi
It will run each time you select a cell.
Did you put the macro in the right place? It does NOT go into a
general code module, it goes into the code module behind the
particular sheet you will be selecting cells in. As I said, to see
this code module open the visual basic editor, identify the sheet in
the explorer pane (e.g. sheet1) and double click it.
regards
Paul

On Apr 11, 3:43 pm, moshe_xls
wrote:
Thank you Paul for your replay,

I insert the code as a macro and didn't get anything - how can I make it run?
My be I didn't make my self clear - I want this program to be run
automatically for any cell I will chose (I couldn't understand if it's in the
code).

Best regards,
Moshe



" wrote:
Hi
Put this code in the code module behind the sheet where you want to
colour cells.


Option Explicit
Dim lastCell As Range


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Target.Interior.ColorIndex = 6
On Error Resume Next
lastCell.Interior.ColorIndex = xlColorIndexNone
Set lastCell = Target
End Sub


(To see this code module, open the visual basic editor, identify the
sheet in the explorer pane and double click it)


regards
Paul


On Apr 11, 7:48 am, moshe_xls
wrote:
I'm looking for a macro that marks the current cell in worksheet. It has to
be a dynamic function (for any move the current cell will be mark). I want
that the cell will be colored.
Is there a built-in option for that? If yes how can I defined it? - Hide quoted text -


- Show quoted text -


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default change the background's color for current cell

Thanks its work beautifully :-)

" wrote:

Hi
It will run each time you select a cell.
Did you put the macro in the right place? It does NOT go into a
general code module, it goes into the code module behind the
particular sheet you will be selecting cells in. As I said, to see
this code module open the visual basic editor, identify the sheet in
the explorer pane (e.g. sheet1) and double click it.
regards
Paul

On Apr 11, 3:43 pm, moshe_xls
wrote:
Thank you Paul for your replay,

I insert the code as a macro and didn't get anything - how can I make it run?
My be I didn't make my self clear - I want this program to be run
automatically for any cell I will chose (I couldn't understand if it's in the
code).

Best regards,
Moshe



" wrote:
Hi
Put this code in the code module behind the sheet where you want to
colour cells.


Option Explicit
Dim lastCell As Range


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Target.Interior.ColorIndex = 6
On Error Resume Next
lastCell.Interior.ColorIndex = xlColorIndexNone
Set lastCell = Target
End Sub


(To see this code module, open the visual basic editor, identify the
sheet in the explorer pane and double click it)


regards
Paul


On Apr 11, 7:48 am, moshe_xls
wrote:
I'm looking for a macro that marks the current cell in worksheet. It has to
be a dynamic function (for any move the current cell will be mark). I want
that the cell will be colored.
Is there a built-in option for that? If yes how can I defined it? - Hide quoted text -


- Show quoted text -



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
Change tab color based on current color of a cell MarkT Excel Discussion (Misc queries) 0 May 22nd 08 05:46 PM
Change Cell Color if in current Month Leslie Excel Worksheet Functions 6 June 28th 05 06:17 PM
a way to color the CURRENT row or cell when selected haneira Excel Programming 2 June 6th 05 10:23 AM
Current Cell Color mike47338 Excel Worksheet Functions 5 December 10th 04 06:45 PM


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