Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 38
Default Conditional Formatting in ref to active cell

I would like to apply conditional formatting in column B to highlight the
cell in the same row as the active/selected cell. Is there a way to
reference the active cell in a function/formula? I'm using 2003 pro.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,069
Default Conditional Formatting in ref to active cell

This doesn't use conditional formatting, but achieves the same effect.

Pthis code in the code page for the sheet where you want this to happen:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
ActiveSheet.Range("B1").EntireColumn.Interior.Colo rIndex = xlColorIndexNone
ActiveSheet.Range("B" & Target.Row).Interior.ColorIndex = 36
End Sub

If you are new to macros, david mcritchie has some instructions on his site
for navigating the vba editor and how to copy/paste macros into your project.

http://www.mvps.org/dmcritchie/excel/excel.htm

Hope this helps,

Hutch

"KUMPFfrog" wrote:

I would like to apply conditional formatting in column B to highlight the
cell in the same row as the active/selected cell. Is there a way to
reference the active cell in a function/formula? I'm using 2003 pro.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,069
Default Conditional Formatting in ref to active cell

Here is another way that does use conditional formatting. In a VBA module in
your workbook, paste this user-defined function:

Public Function CurrRow() As Long
CurrRow = ActiveCell.Row
End Function

In the ThisWorkbook module of the workbook, paste this event code:

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target
As Range)
Calculate
End Sub

On the worksheet where you want to apply the condition formatting, select
column B, then select Conditional Formatting from the Format menu. Change
'Cell Value Is' to 'Formula Is' and enter the following formula:

=(ROW(B1)=CurrRow())

Then click the Format button to select however you want the column B cells
to be highlighted. Click OK to close the Format dialog, then OK again to
close the Conditional Formatting dialog.

Hope this helps,

Hutch

"KUMPFfrog" wrote:

I would like to apply conditional formatting in column B to highlight the
cell in the same row as the active/selected cell. Is there a way to
reference the active cell in a function/formula? I'm using 2003 pro.

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
Conditional Formatting of Entire Row when the Active Cell is in ro Shannon Excel Discussion (Misc queries) 11 April 29th 08 09:31 PM
Protect Cell Formatting including Conditional Formatting Mick Jennings Excel Discussion (Misc queries) 5 November 13th 07 05:32 PM
conditional Formatting based on cell formatting Totom Excel Worksheet Functions 3 January 20th 07 02:02 PM
conditional Formatting based on cell formatting Totom Excel Worksheet Functions 0 January 15th 07 04:35 PM
Change Formatting In 'Active' Cell JB2010 Excel Discussion (Misc queries) 4 February 2nd 06 05:58 PM


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