Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Identify shape in cell

I have a sheet that was populated with data from a table copied from a
website. One of the rows has cells which contain shapes rather than
text. I need to convert these shapes to text and delete the shapes.
Two questions:

How can I take the current selection and determine just what shape is
in it?
How can I delete that shape after I set the value property to the
desired text?

Something like TypeName(Selection) will tell me that I have a shape if
what is selected is the shape itself. I actually want to select the
cell (or a range of cells) and, based on this, figure out what the
shape might be.

Thanks!

-Martin

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Identify shape in cell

This is not a simple problem. First shapes are not in cells but onto of
cells. You can get each shape with the following:

For Each shp In ActiveSheet.Shapes
Shapetext = ActiveSheet.OLEObjects(shp.Name).Object
For RowCount = 1 To Rows.Count
If Range("A" & RowCount).Top shp.Top Then
ShapeRow = RowCount
Exit For
End If
Next RowCount
For ColCount = 1 To Columns.Count
If Cells(1, ColCount).Left shp.Left Then
ShapeCol = ColCount
Exit For
End If
Next ColCount
Cells(ShapeRow, ShapeCol) = Shapetext
shp.Delete
Next shp

The problem then becomes which cell is closest to these shapes. Cells have
both Rows and columns as well as there pixel locations found with TOP & LEFT.
The pixel location change when you make columns and rows wider or narrower.
The shapes only have Top and Bottom.

"m" wrote:

I have a sheet that was populated with data from a table copied from a
website. One of the rows has cells which contain shapes rather than
text. I need to convert these shapes to text and delete the shapes.
Two questions:

How can I take the current selection and determine just what shape is
in it?
How can I delete that shape after I set the value property to the
desired text?

Something like TypeName(Selection) will tell me that I have a shape if
what is selected is the shape itself. I actually want to select the
cell (or a range of cells) and, based on this, figure out what the
shape might be.

Thanks!

-Martin


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
how to identify a shape as a picture in excel from VB Uwe Excel Programming 2 January 19th 08 11:23 PM
my curser changed from arrow shape to a cross shape???? bj New Users to Excel 1 February 5th 07 02:47 PM
Move shape, object, pic to center of new cell based on cell value zzxxcc Excel Programming 4 July 7th 06 12:58 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 05: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"