ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Setting the formula property of a textbox (https://www.excelbanter.com/excel-programming/302829-setting-formula-property-textbox.html)

Dino

Setting the formula property of a textbox
 
After creating a textbox:
Worksheets(ActiveSheetName).Shapes.AddTextbox.Sele ct

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

this works:

selection.Formula = sForm

this does not:

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


Peter T[_3_]

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

& "":"" "

.



All times are GMT +1. The time now is 02:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com