Creating a action for a defined object

A

Adrix

hello
first of all my apologizes for allways posting questions instead o
solutions, but I m still too beginner in programming.

I create a macro that format a range . Is it possible to "give" th
range the power to call it. Let´s say it is possible what i want to d
is have the abillity to call it just like:

range("myrange").mymacro

I know it sounds silly but..

thank you in advance

Adri
 
B

Bob Phillips

No you can't do that, but you can pass the range to the macro, like

Call myMacro(Range("A1:A10")

....

Sub myMacro(Rng As Range)

Msgbox rng.Address

End Sub

--

HTH

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

Adrix

thank you any way.

ps- And it is possible to define a new obejct capable to do a ne
action?

thank
 
B

Bob Phillips

Do you mean such as adding a button to a sheet?

--

HTH

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