View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Peter T[_3_] Peter T[_3_] is offline
external usenet poster
 
Posts: 81
Default Setting the formula property of a textbox

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

-----Original Message-----
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 & "

& "":"" "

.