Setting the formula property of a textbox

D

dino

After creating a textbox:
Worksheets(ActiveSheetName).Shapes.AddTextbox.Select

I try to set its formula (where sForm="Sheetname!B8"):

this works:

selection.Formula = sForm

this does not:

selection.Formula = "= " & sForm & " & "":"" "
 
P

Peter T

AFAIK the only type of formula you can put into a Textbox
or Label is a reference to a single cell, such as you have
successfully been able to do. (Manually - select Textbox,
select input-bar, type an =, then the reference).

As a workaround maybe you could put your desired formula
in a cell (possibly hidden, or on another sheet) then
reference this cell in your Textbox.

If my "AFAIK" is wrong I'm sure someone will be good
enough to correct!

Regards,
Peter
 
Top