PC Review


Reply
Thread Tools Rate Thread

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

 
 
andreashermle
Guest
Posts: n/a
 
      15th Dec 2009
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
 
Reply With Quote
 
 
 
 
Peter T
Guest
Posts: n/a
 
      15th Dec 2009
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" <(E-Mail Removed)> wrote in message
news:ea1dc0a5-913f-4166-a9b3-(E-Mail Removed)...
> 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



 
Reply With Quote
 
andreashermle
Guest
Posts: n/a
 
      16th Dec 2009
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" <andreas.her...@gmx.de> wrote in message
>
> news:ea1dc0a5-913f-4166-a9b3-(E-Mail Removed)...
>
>
>
> > 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- Zitierten Text ausblenden -

>
> - Zitierten Text anzeigen -


Hi Peter,

thank you very much for your terrific help. That's it! Regards,
Andreas
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Make a cell display the contents of a shape JasperBluto Microsoft Excel Worksheet Functions 0 29th Aug 2008 06:17 AM
Display text box contents in cell =?Utf-8?B?bXNhbmRvbWly?= Microsoft Excel Misc 1 13th Feb 2007 02:18 PM
Display contents of cell in another cell as part of text string? mschmidt@carolina.rr.com Microsoft Excel New Users 3 8th Jul 2006 07:44 PM
Display ALL text contents in cell Flipper1067 Microsoft Excel Misc 10 27th Jul 2005 02:22 PM
Deleting a shape and the cell contents the shape is in. John DeFiore Microsoft Excel Programming 3 9th Oct 2003 03:36 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:09 PM.