View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Ken Johnson
 
Posts: n/a
Default Can I get current #row or #column in cell formula?

Hi ryany,
I don't know of any way of achieving this without using an event
procedure.

The following Worksheet_SelectionChange Sub pasted into the code module
of the worksheet works.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If ActiveWindow.ScrollRow < 101 Then
Let Range("A1").Value = "Text1"
Else: Let Range("A1").Value = "Text2"
End If
End Sub

To get the code in place follow the following steps:

1.Copy the above code
2.Right Click the worksheet tab then select "View code" from the
contextual popup menu.
3.Paste the code into the blank code module.
4.Edit the "Text1" and "Text2" strings.
5.Return to Excel worksheet by pressing Alt + F11 or going FileClose
and Return to Microsoft Excel.

Ken Johnson