PC Review


Reply
Thread Tools Rate Thread

Creating several TextBoxes (Shapes) with cell references as contents

 
 
andreashermle
Guest
Posts: n/a
 
      17th Dec 2009
Dear Experts:

below macro grabs the contents of cell B7 and displays it in a text
box (shape, not a control!). The formula is a cell reference so that
the text box contents is updated whenever the respective cell changes
its contents.

I would like to have the macro expanded so that several input boxes
are created with the following requirements:

1. An input box prompts the user to enter a number: this number
represents the iterations / number of text boxes to be created, say
the user has entered the number 5

2. another input box prompts the user to enter the first cell
reference, say B7.

Now the macro should do the following:

1. Iterate thru the macro 5 times
2. The formula part is to change as follows with each loop: the row
number of the cell reference is incremented by 1 with each loop, ie.
B7, B8, B9, B10, B11.
3. All in all: 5 text boxes are to be created with their respective
cell references

Hope this does not exceed the scope of this forum.

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


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

End Sub


 
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
how to use cell contents as references in a formula =?Utf-8?B?aHVzc2FtODE=?= Microsoft Excel Worksheet Functions 1 28th Feb 2006 06:59 PM
Excel VBA - Remove Shapes and Cell Contents rick6823 Microsoft Excel Programming 1 11th Apr 2004 10:50 PM
Excel VBA - Clearing Shapes and Cell Contents =?Utf-8?B?Umljaw==?= Microsoft Excel Programming 2 10th Apr 2004 12:26 AM
Moving contents of a cell without changing references to that cell elbows Microsoft Excel Misc 2 29th Mar 2004 05:01 PM
creating and using cell references joeZy Microsoft Excel Misc 1 19th Feb 2004 02:32 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:38 PM.