View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Patrick Molloy[_2_] Patrick Molloy[_2_] is offline
external usenet poster
 
Posts: 1,298
Default Programming "Shape" objects (Part 2)

use the sheet's change event -- right click the sheet tab and select view code

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range("A1").Address Then
Shapes("Oval 1").Select
Selection.Characters.Text = Target.Value
Target.Select
End If
End Sub


With many of these types of question, switching on the macro recorder and
seeing what Excel itself does can be enlightening.


"Robert Crandal" wrote:

Well, I seem to have discovered that I can reference and change any property
of any shape object using the Worksheets(1).Shapes(?)...etc name reference.
So I guess u can ignore my previous question.

However, now I have another question:

Shape objects can contain text in the middle. I would like my shape object
to
always display or mirror the contents of cell "A1". So any time the
contents
of cell A1 changes, I would like my shape object to notice this event and
copy
the contents of A1 to my shape object's text property.

How can this be done??

Thank you!


"Robert Crandal" wrote in message
...
My spreadsheet contains multiple "shape" objects. I would like to be able
to
change the properties of my various shapes when certain events happen, but
the problem is I don't know the names of my shapes. How are shape objects
referenced in Visual Basic code??

Do I use the following reference format :

Worksheets(1).Shapes(1)..... etc. etc....

If I have 10 shapes on my spreadsheet does, how does Visual Basic
determine
which shape gets assigned which numer or name??

Thank you!

Robert


.