View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default How do I programmatically know the current cell's address

Another possibility

Sub TestPrecedents()
Range("A1").Formula = "=C9^2"
Set rng = Range("A1").DirectPrecedents
MsgBox rng(1).Address & " row: " & rng(1).Row & _
" col: " & rng(1).Column

End Sub



--
Regards,
Tom Ogilvy

"J.E. McGimpsey" wrote in message
...
Not sure what your given f(x) has to do with it, but you can find
the row and column numbers for any cell as

Dim n As Long
Dim m As Integer
Dim cell As Range
Set cell = <given cell
With cell
n = .Row
m = .Column
End With


If you're talking about worksheet functions instead of programming,
then for f(x) = SUM(n, m):

=SUM(ROW(),COLUMN())

will give the sum of the row number and column number.

In article ,
"Keith" wrote:

Question:
Given a formula, say f(x), assigned to any given cell, c
(n,m), I need to know n and m. Can any one help me?

Thanks

kc