LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Inserting a drawing object into a cell


Hi Everyone,
I am attempting to insert a small rectangle in a column of cells.
I have searched this forum and have found some examples but have run
into problems when attempting
to use them as illustrated. I managed to cobble together this block of
code included below.
Although it works i.e., it places a small rectangle centered in the
cells in rows 1 thru 10,
column 1, it seems border line kludgy and I have to believe there is a
better way.
Please advise. Thx in advance.
RPrinceton

Dim r as integer
Dim c as integer
Dim shObj as Object
Dim myRect as String
Dim rectSZ as Integer
c = 1
For r = 1 To 10
With Worksheets(1).Cells(r, c)
Set shObj = .Parent.Shapes.AddShape(Type:=msoShapeRectangle, _
Left:=.Left + (.Width -
rectSz) / 2, _
Top:=.Top + (.Height -
rectSz) / 2, _
Width:=rectSz, _
Height:=rectSz)
End With
myRect = "Rectangle " & r ' give rectangle a name
ActiveSheet.Shapes(myRect).Placement = xlMove ' insert rectangle into
cell
Next r


--
RPrinceton
------------------------------------------------------------------------
RPrinceton's Profile: http://www.excelforum.com/member.php...fo&userid=2493
View this thread: http://www.excelforum.com/showthread...hreadid=377465

 
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
easier method for inserting object in cell Radhakant Panigrahi Excel Discussion (Misc queries) 0 April 22nd 10 03:59 PM
how do i prepare a macro to insert drawing object on specific cell Harshad[_2_] Excel Discussion (Misc queries) 2 November 25th 08 08:06 AM
Position drawing object relative to cell Horatio J. Bilge, Jr. Excel Discussion (Misc queries) 2 September 29th 08 09:16 PM
how do i copy and inserted drawing object in a cell to multiple ce BROCK8292 Excel Discussion (Misc queries) 1 February 20th 07 09:11 PM
Drawing Object Shawn Excel Programming 2 March 2nd 05 03:04 PM


All times are GMT +1. The time now is 02:58 AM.

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

About Us

"It's about Microsoft Excel"