Setting the formula property of a textbox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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 & " & "":"" "
 
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
 

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