Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Change text colour of a cell when a different cell is selected

This problem is likely to be very easy for anyone with basic macro
knwoledge.

I need to know how to automatically change the colour of the text in
cell B4 to red everytime cell A4 is selected, then back to black when
cell A4 is unselected. Also, where do I place the code to perform this?

Any help will be much appreciated.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 695
Default Change text colour of a cell when a different cell is selected

try put in sheet-tab kode-window


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If ActiveCell.Row = 4 And ActiveCell.Column = 1 Then
Cells(4, 2).Font.ColorIndex = 3
Else
Cells(4, 2).Font.ColorIndex = 1
End If
End Sub



" skrev:

This problem is likely to be very easy for anyone with basic macro
knwoledge.

I need to know how to automatically change the colour of the text in
cell B4 to red everytime cell A4 is selected, then back to black when
cell A4 is unselected. Also, where do I place the code to perform this?

Any help will be much appreciated.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default Change text colour of a cell when a different cell is selected

1. Invoke VBE (Alt+F11)!
2. Right click on your project name in project window, choose Insert/Module
from the local menu!
3. Copy this function into window Module 1!
Function IsSelected(cellref)
IsSelected = ActiveCell.Address(False, False) = cellref
End Function
4. Right click on your sheet name (say Sheet1) in project window, choose
View code!
5 Insert this event macro into window Sheet1
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Calculate
End Sub
6. Go back to Sheet1, select cell B4!
7. Formats/Conditional formatting, choose formula as condition and enter
=isselected("A4") into the formula field, press Format button and select Font
tag, apply red color, then OK/OK!

Regards,
Stefi

ezt *rta:

This problem is likely to be very easy for anyone with basic macro
knwoledge.

I need to know how to automatically change the colour of the text in
cell B4 to red everytime cell A4 is selected, then back to black when
cell A4 is unselected. Also, where do I place the code to perform this?

Any help will be much appreciated.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Change text colour of a cell when a different cell is selected

The following will change the font color of cell B4 when active

If ActiveCell = Cells(4, 1) Then
Cells(4, 2).Font.ColorIndex = 3
Else
Cells(4, 2).Font.ColorIndex = 1
End If

Paste it into your Worksheet_SelectionChange(ByVal Target As Range)
event.

Christian

wrote:

This problem is likely to be very easy for anyone with basic macro
knwoledge.

I need to know how to automatically change the colour of the text in
cell B4 to red everytime cell A4 is selected, then back to black when
cell A4 is unselected. Also, where do I place the code to perform this?

Any help will be much appreciated.


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
how do i change cell text colour based on value in other cell Oscarrot Excel Worksheet Functions 2 July 20th 09 03:21 PM
Change selected cell shading colour Chas Excel Discussion (Misc queries) 2 July 7th 09 06:54 PM
Default value for selected cell colour change Excel 2007 Bob Setting up and Configuration of Excel 1 May 21st 08 04:17 PM
How to change cell text based on another selected cell? jjh Excel Discussion (Misc queries) 1 July 6th 06 01:14 PM
how do i get cell to change colour when text is added to it to hi. Mav Excel Discussion (Misc queries) 2 April 23rd 05 10:30 AM


All times are GMT +1. The time now is 07:34 PM.

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"