Column Number of active cell

H

Hari

Hi,

In VB I want to know the column number of activecell.

I tried

p = Application.WorksheetFunction.Column(ActiveCell)

But im getting Run error 438 . Object doesnt support this property or
method.

I also tried p = Application.WorksheetFunction.Column()

But Im getting the same error.

Please tell me the correct syntax

Regards,
Hari
India
 
B

Bob Phillips

Activecell.Column

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
H

Hari

Hi Bob and Rohn,

Thanx a lot for ur timely help. Im able to get what I wanted now.

I have 2 doubts based on my previous unsuccessful attempt :-

a) When we use a worksheet function in VBA it is said that if we insert
"Application.WorksheetFunction." before the actual formula then one will be
able to get what one wanted. Why is this not happening in this case?

b) In view of my doubt in part a) is ActiveCell.Column a VB specific
function..

Regards,
Hari
India
 
D

Dave Peterson

Open up the VBE and start help.

Search for: "List of Worksheet Functions Available to Visual Basic"

You'll see that =column() isn't one of those functions.

Some functions have their own VBA equivalent:

=Upper() isn't there because VBA has uCase().

=proper() is there, because VBA doesn't have pCase().

(althought it does have strconv())
 
H

Hari

Hi Dave,

Thanx a lot Dave for leading me to the correct source.

I tried help but didnt know/try with the Right combination of query words in
help.

Than again for letting me know that "List of Worksheet Functions Available
to Visual Basic" is the correct combination of words.

Just like searching in Google for some info for searching "Help" one needs
to have a knack. I hope with time I become better and better in this.

Regards,
Hari
India
 
D

Dave Peterson

It's kind of like checking the spelling of a word in the dictionary.

If you know how to spell it, it's easy. If you're not close, you'll have
trouble!
 
Top