View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Find address of active cell

Billigmeier's formula works very well, but needs the F9 to refresh. if you
want to save wear and tear on F9, consider the following worksheet code:


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Row = 5 Then
Cells(5, 1).Value = "X"
Else
Cells(5, 1).Value = ""
End If
End Sub

It will set/clear A5 depending upon the location of the selected code.
--
Gary''s Student


"Dave" wrote:

Thanks for the the suggestion but the formula seems to always return true
even when the active cell is no longer in the row with the fromula.
I need to compare the row that contains the formula with the row of the
active cell.
If they are the same then display "X" else display nothing.


"David Billigmeier" wrote:

Use the CELL() function, CELL("row") will always return the row of the active
cell:

=IF(ROW()=CELL("row"),"X")

Note this will continue to populate if the active cell is in the same row on
another tab as well.
--
Regards,
Dave


"Dave" wrote:

Is there a function that returns the row, column or address of the active cell?
I'd like to build a formula in a column that displays a character if the
active cell is in that row, such as:
=IF(ROW()=ROW(ActiveCell),"X")
Thanks.