Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 123
Default 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(msoTextOrientationHo rizontal, 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Display cell contents in a text box (shape) and linking

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" wrote in message
...
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(msoTextOrientationHo rizontal, 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 123
Default Display cell contents in a text box (shape) and linking

On 15 Dez., 13:33, "Peter T" <peter_t@discussions wrote:
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" wrote in message

...



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(msoTextOrientationHo rizontal, 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- Zitierten Text ausblenden -


- Zitierten Text anzeigen -


Hi Peter,

thank you very much for your terrific help. That's it! Regards,
Andreas
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Make a cell display the contents of a shape JasperBluto Excel Worksheet Functions 0 August 29th 08 06:17 AM
Display text box contents in cell msandomir Excel Discussion (Misc queries) 1 February 13th 07 02:18 PM
Display ALL text contents in cell Flipper1067 Excel Discussion (Misc queries) 10 July 27th 05 02:22 PM
Deleting a shape and the cell contents the shape is in. Dave Peterson[_3_] Excel Programming 1 October 9th 03 03:36 PM
Deleting a shape and the cell contents the shape is in. Tom Ogilvy Excel Programming 0 October 9th 03 03:43 AM


All times are GMT +1. The time now is 10:57 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"