Determine Column Number in a function

  • Thread starter Thread starter cubbybear3
  • Start date Start date
C

cubbybear3

I have a function that needs to know the column number/letter of the
cell calling it. How does a novice like myself do this? Thanks. -
pb
 
Function ColNum() As Integer
ColNum = Application.Caller.Column
End Function

Just enter =ColNum() in a cell.
However, =COLUMN() does that already!
 
Here's an example of the Caller Property you would use on the application
within the custom function.

Dim v as StringSelect Case TypeName(Application.Caller)
Case "Range"
v = CStr(Application.Caller.Column)
Case Else
v = "unknown"
End Select
MsgBox "Column number calling this function is " & v & "."-- Sincerely,
Ronald R. Dodge, Jr.
Master MOUS 2000
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top