Display cell contents in a text box (shape) and linking

Dear Experts:

below macro grabs the contents of cell B7 and displays it in a text
box (shape, not a control!). How do I have to re-write the code to
have the contents of the cell linked to the contents of the shape.
That is, whenever the cell contents changes, the contents of the text
box is to be updated as well.

Help is much appreciated. Thank you very much in advance. Regards,
Andreas


Sub AddTextBox()
 ActiveSheet.Shapes.AddTextBox(msoTextOrientationHorizontal, 97.5,
28.5, 96.75 _
        , 17.25).Select
    Selection.Characters.Text = Range("B7")
    With Selection.Font
        .Name = "Arial"
        .FontStyle = "Regular"
        .Size = 10
     End With
0
andreashermle
12/15/2009 6:40:45 AM
excel.programming 6508 articles. 2 followers. Follow

2 Replies
986 Views

Similar Articles

[PageSpeed] 46

Sub AddTextBox()
Dim shp As Shape
 Set shp = ActiveSheet.Shapes.AddTextBox( _
        msoTextOrientationHorizontal, 97.5, 28.5, 96.75, 17.25)
    'shp.DrawingObject.Text = Range("B7")
    shp.DrawingObject.Formula = "$B$7" ' or "B7"
    With shp.TextFrame.Characters.Font
        .Name = "Arial"
        .FontStyle = "Regular"
        .Size = 10
     End With

End Sub

Regards,
Peter T

"andreashermle" <andreas.hermle@gmx.de> wrote in message 
news:ea1dc0a5-913f-4166-a9b3-a524046b6bff@p8g2000yqb.googlegroups.com...
> Dear Experts:
>
> below macro grabs the contents of cell B7 and displays it in a text
> box (shape, not a control!). How do I have to re-write the code to
> have the contents of the cell linked to the contents of the shape.
> That is, whenever the cell contents changes, the contents of the text
> box is to be updated as well.
>
> Help is much appreciated. Thank you very much in advance. Regards,
> Andreas
>
>
> Sub AddTextBox()
> ActiveSheet.Shapes.AddTextBox(msoTextOrientationHorizontal, 97.5,
> 28.5, 96.75 _
>        , 17.25).Select
>    Selection.Characters.Text = Range("B7")
>    With Selection.Font
>        .Name = "Arial"
>        .FontStyle = "Regular"
>        .Size = 10
>     End With 


0
Peter
12/15/2009 12:33:45 PM
On 15 Dez., 13:33, "Peter T" <peter_t@discussions> wrote:
> Sub AddTextBox()
> Dim shp As Shape
> =A0Set shp =3D ActiveSheet.Shapes.AddTextBox( _
> =A0 =A0 =A0 =A0 msoTextOrientationHorizontal, 97.5, 28.5, 96.75, 17.25)
> =A0 =A0 'shp.DrawingObject.Text =3D Range("B7")
> =A0 =A0 shp.DrawingObject.Formula =3D "$B$7" ' or "B7"
> =A0 =A0 With shp.TextFrame.Characters.Font
> =A0 =A0 =A0 =A0 .Name =3D "Arial"
> =A0 =A0 =A0 =A0 .FontStyle =3D "Regular"
> =A0 =A0 =A0 =A0 .Size =3D 10
> =A0 =A0 =A0End With
>
> End Sub
>
> Regards,
> Peter T
>
> "andreashermle" <andreas.her...@gmx.de> wrote in message
>
> news:ea1dc0a5-913f-4166-a9b3-a524046b6bff@p8g2000yqb.googlegroups.com...
>
>
>
> > Dear Experts:
>
> > below macro grabs the contents of cell B7 and displays it in a text
> > box (shape, not a control!). How do I have to re-write the code to
> > have the contents of the cell linked to the contents of the shape.
> > That is, whenever the cell contents changes, the contents of the text
> > box is to be updated as well.
>
> > Help is much appreciated. Thank you very much in advance. Regards,
> > Andreas
>
> > Sub AddTextBox()
> > ActiveSheet.Shapes.AddTextBox(msoTextOrientationHorizontal, 97.5,
> > 28.5, 96.75 _
> > =A0 =A0 =A0 =A0, 17.25).Select
> > =A0 =A0Selection.Characters.Text =3D Range("B7")
> > =A0 =A0With Selection.Font
> > =A0 =A0 =A0 =A0.Name =3D "Arial"
> > =A0 =A0 =A0 =A0.FontStyle =3D "Regular"
> > =A0 =A0 =A0 =A0.Size =3D 10
> > =A0 =A0 End With- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -

Hi Peter,

thank you very much for your terrific help. That's it! Regards,
Andreas
0
andreashermle
12/16/2009 2:55:57 PM
Reply:

Similar Artilces:

link excel with access
Is it possible to link Excel with access such that any changes made in Excel will also occur in the access database? In other words, I need to maintain a 2-way linkage between the 2, but I want all my data to reside in the database, not the spreadsheet. I understand that creating a Linked table in Access would accomplish the linkage I want, but it creates problems when I link that table with a Visio drawing...which is why the data needs to stay in the Access DB. Anyone have any suggestions? I know that vba will accomplish this, but I am not an expert in that field. Any help would be appre...

Return a cell refernce based on a value
I have a value in worksheet A which is "x". In worksheet B column A have a list of values i.e. a,b,c,d...x,y,z and in column B I hav values relating to those in coumn A i.e. column A row 1 value is "a column B row 1 value is "apple", column A row 2 value is "b" and colum B row 2 value is "balloon", how do I get teh first worksheet to rea the value in one cell, find it in column A of the other worksheet an give back the value on teh same row in column B? Thank -- Message posted from http://www.ExcelForum.com Hi use the VLOOKUP function =VLOOKU...

Dual Displays
I want to connect my Sharp Aquos flat screen TV to my computer, and see my desktop on both the TV and computer monitor. Windows Vista Home Premium. HP Pavilion a1610n computer. Galaxy GeForce 8400 GS graphics card, outputs: 1-VGA, 1-DVI, and 1-SVGA. There is no HDMI port on the card. I connected a VGA cable between the motherboard "on-board" VGA port and the TV, figuring that I could use that output to work with the TV. The computer monitor is plugged into the GeForce graphics card. Tried the Desktop "Display Setting". It says, the number 2 monitor is "N...

Define name box size too small for viewing large formulas
Hi, When we create a new name using insert and define name then if the formula is long it becomes difficult to view the whole formula. Also one is not able to use navigation buttons left,right here as if we do that then the formula gets modified. is there any way to see the whole formula. Like for creating ever expanding validation list using Debra's technique one uses offset etc but one is not able to view the whole big formula. Please guide me. Regards, Hari India Hi try hitting F2 while in this text box. After this you should be able to navigate within this box. -- Regards Frank ...

Find cell which returned maximum value in formula
-- De De, try this, =CELL("address",INDEX(A:A,MATCH(MAX(A:A),A:A,0))) will show the first one if there are more than one -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2002 & 2003 "De" <De@discussions.microsoft.com> wrote in message news:A17DFFDA-BE05-463C-B68D-65FE235E6098@microsoft.com... > > -- > De Thanks, Paul, but I found this hard to follow. Excel kept returning that I had disabled macros but yo...

Folder could not be displayed
I am running Windows XP and Outlook Express 6 just fine then one day my husband does something to my computer and his email account won't work. My email is working just fine but in his he cannot open his inbox. It says folder could not be displayed, and when you send and receive it gives you this error message: "An unknown error has occured. Account: 'incoming.verizon.net'. Server:'incoming.verizon.net'.Protocol:POP3, port: 110, Secure(SSL): No, error number: 0x800C013B" If anyone could help me with this I would greatly appreciate it. Thank you T...

Display a message box "this entry is a duplicate"
How can I display a message box on a form if the shipment number is a duplicate? I need a message box to pop up when user attempts to tab out of the field. Thank you. Something like: Private Sub txtShipNum_BeforeUpdate(Cancel As Integer) If DCount("*", "MyTable", "ShipNum = '" & Me.txtShipNum & "'") > 0 Then Msgbox Me.txtShipNum & " already exists." Cancel = True End If End Sub This assumes that your text box is named txtShipNum, that the name of the field in table MyTable is ShipNum...

Dynamic Range Based on Cell Result not Empty Cell
I use dynamic ranges in excel. I use them to name ranges that vary i size due to varyin data. For example, I may dump data in F2 which ma span 3 rows or 100 rows. I use the following formula to name th range: =OFFSET($F$2,0,0,COUNTA($F2:$F65536),1) However, I now want to define the range based on the cell result. Tha is assume that I have a constant formula from F2 to F102. However th cells in the column either have a number in them or a "" in them. Th formula above will automatically size the range to F2:F102 becuas there is a formula in every row. How can i write a formua...

how to display values in 3 cells into one cell
Anyone can help me how do I display the 3 separate different values in 3 cells into just one single cell ? thanks so much in advance. Either there was a typo or there's an echo in here. That line should have been: = A1 & " " & B1 & " " & C1 "Bradley Dawson" <bradleydawson@earthlink.net> wrote in message news:l464b.2224$Lk5.2093@newsread3.news.pas.earthlink.net... > In the target cell, type: > > = A1 & B1 & C1 > > where A1, B1, C1 are the cell addresses that you want to concatenate. > > If these have number...

Linking linked sub reports to a linked Report
I have a report, report A, located in folder A location. I have a linked report of Report A, located in folder B location. I have a sub report, sub report A, located in folder A location. I have a linked sub report of sub report A, located in folder location b. Linked Report A works to an extent when its in Location B, but all of its sub reports are not working. (Error: Subreport could not be shown.) When you go into sub report A in location B and run it as a "report" and it works just fine, so the report works, it just doesn't like being a linked sub report ...

How to select & display distinct values
Hello, I need help with a form please. My form has two controls, the first being a combo box. This box should select the company name from a lookup table. The lookup table has only two companies in it, however, they each are repeated several time. Company 1 has about 10 rows, company 2 has 3 rows. I used the query builder and came up with the statement: "SELECT DISTINCT Lktbl_Role_Master.CompanyName FROM Lktbl_Role_Master;" When I run the statement directly from query view, it executes perfectly and returns exactly two rows (one for each company, in a datasheet view) ho...

grey text box
Need help adding the grey box to a document to click and fill basically. Deanna wrote: > Need help adding the grey box to a document to click and fill > basically. See http://www.computorcompanion.com/LPMArticle.asp?ID=22. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. ...

Word Cells into Excel Cells #2
How does one import a cell formatted Word file *.doc into cells within Excel *.xls. By "cell formatted Word file", do you mean a table? I would simply select table and click copy. Then open excel and paste it where you want it to appear. J "gary" wrote: > How does one import a cell formatted Word file *.doc into > cells within Excel *.xls. > > > jayceejay Wrote: > By "cell formatted Word file", do you mean a table? I would simpl > select > table and click copy. Then open excel and paste it where you want i > to > ap...

Display Time in Outlook
The time setting in my Outlook is one hour behind my actual time. I cannot determine how to change the time. Outlook is the only item that is incorrect. Other display times in operating system are correct. Thanks, Jodi ...

autofilling cells
say i have a in A1, b in A7, c in A9 how do i insert a in A2 - A6, b in A8 and "c" in A10 - A21 TIA Hi Select your range of cells in column A. Edit / Go to / Special / Blanks. Type = and then press up arrow. Then hit Shift Enter. If you are happy with this result, select the range again and Edit / Copy then Edit / Paste Special / Values to fix the values in place. Andy. "John Smith" <a__@abv.bg> wrote in message news:uZuZ1$8FEHA.1884@TK2MSFTNGP11.phx.gbl... > say i have a in A1, b in A7, c in A9 > how do i insert a in A2 - A6, b in A8 and > "c&q...

PK and FK Displayed
I am a complete Visio newbie, and cannot find the answer I need in books or online help. I am trying to create ER diagrams from scratch, and not connected to real tables, using VEA. I have added tables ('Entities') to the form, connected them with a Relationship connector, and, in the Database Properties window I've assigned the end points to a Primary Key on the left and a Foreign Key on the right. But the model shows the connector as running between the top colums on both sides, whereas I want the keys to be in that upper box and provide the connector's end points. Wh...

Formulas are displayed, results are not
Hello, For some reason, when I enter a formula into a cell and press enter, the formula just stays there. Anyone know what I can do to show the results? I tried pressing Cntrl + `, but that didn't work. FYI, when I cut and paste a column from a separate workbook, that column works like normal (i.e., the formulas produce results). Thanks for any suggestions! Hi Mike, Maybe your cell is preformatted as Text. Try formatting to general then erase your = and type it in again. HTH Martin "Mike C" <js2k111@yahoo.com> wrote in message news:f699bcd4-ad82-4a88-9759-5638c147b...

Converting number to text
Is it possible to convert, say 1234 to one thousand two hundred and thirty four Thanks There is no direct functions to convert this. For a VBA solution check out the below links http://www.ozgrid.com/VBA/ValueToWords.htm http://support.microsoft.com/kb/213360 http://www.xldynamic.com/source/xld.xlFAQ0004.html -- Jacob (MVP - Excel) "booshi" wrote: > Is it possible to convert, say 1234 to one thousand two hundred and thirty > four > > > Thanks > > > . > ...

Two address/one box
Due to a server crash we made changes to email addresses. Now some people are not receiving their email. Can we have two email addresses going into one email box? How? Please be specific as I am new at this. Thanks! You can set up an alias for the person within the exchange properties (sorry can't remember which tab) "Sam" wrote: > Due to a server crash we made changes to email addresses. Now some people > are not receiving their email. Can we have two email addresses going into > one email box? How? Please be specific as I am new at this. > Thanks! ...

Stop displaying a line
I have a line graph/chart and it gets its values using a formula and the values of another column. However this poses a problem because if there is nothing in the targetted column the formula returns 0 cause the line to drop to the bottom, instead of casuing the line to just end until a value is added to the target column. How can I do this? Change your formula to use NA() if the cell is empty. For example: =IF(A1="",NA(),A1) To hide the resulting #N/A errors on the worksheet, you can use conditional formatting. There are instructions here: http://www.contextures.com/xlC...

A question about Console window(display or not display)
I've redirected the (stdin stdout stderr) of a console window process I spawned to a pipe. And I want to display the redirected console window, the question is: If I display it(set Create_new_CONSOLE in createprocess and some flags in startupinfo), I cannot use the redirected way of pipe, which means if i do not display, i can use the pipe communicating with the child process. Does it mean that as long as I disply the console window, windows will change stdin stdout to "screen&keyboard" instead of my pipe? That's right. If you redirect stdin or stdout then you preemp...

unattached textboxes disappear when a msgbox is displayed on a tab control
I'm using Access 2003. I have a form with a tab control on it. I was having problems with labels flashing and I followed the suggesting from Allen Browne - http://allenbrowne.com/ser-46.html. The flashing went away but now when a msgbox is displayed the unattached textboxes that I'm using as labels disappear. They come back as soon as the msgbox is removed from the screen. I've searched google looking for an answer but have come up short. Does anyone know why I'm experiencing this behavior and how to make it go away? Thanks, Rick That *is* strange. Have you tr...

Display or not display series
I have a graph with four series but some of the series may be blank, i.e. the series name is <blank series>. Is there a way to not display these series on the graph and/or legend if they are blank, and display them if they are without deleting the series? Thanks! Clay Create a chart from all the data Select the data on which the chart is based. Choose Data>Filter>AutoFilter In the heading cell for the series name column, select (NonBlanks) from the dropdown list The series with blank name cells will be hidden in the chart. Clay wrote: > I have a graph with four serie...

does Excel support multiple display monitors?
Hello All Excel Experts How do I move chart windows to multiple display montors?? (one computer runnng three monitors... Excel Charts will not move off the primary monitor. Your advice is EXTREMELY appreciated thanks. Denni ...

Comment Type Box??
Is it somehow possible to assign a description box/ comment box to an item so that when that item is entered or scanned it pops up allowing text to be entered. (A bit like ctrl+F10). Any help would be brill !! Really the only way out of the box is with CTRL+F10. A customization would certainly be able to make this happen though. If you are intested in finding out what it would take to make happen, drop me an email and we can discuss. -- Thank you, Ryan Sakry Program Manager Retail Information Technology Enterprises 320-230-2288 rsakry@rite.us http://www.rite.us ...