Dynamic property names

T

Tone

Hi all

In VBA/Excel is there any way I can dynamically refer to property
names. By this I mean that I want to pass a property name as a
parameter e,g,

sub aSub (aCell as Range, aVal as Variant, prop as ???)

....
aCell.prop = aVal ' or some such

....
end sub

so the input parameter "prop" could be "value" or "formula" or
whatever.

Many thanks

Tone
 
T

Tone

Hi all

In VBA/Excel is there any way I can dynamically refer to property
names.  By this I mean that I want to pass a property name as a
parameter e,g,

sub aSub (aCell as Range, aVal as Variant, prop as ???)

...
   aCell.prop = aVal  ' or some such

...
end sub

so the input parameter "prop" could be "value" or "formula" or
whatever.

Many thanks

Tone

Answered my own question! - use the function "CallByName"

T
 

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

Top