dealing with autoshapes

Jackeb

Board Regular
Joined
Mar 20, 2002
Messages
81
Here is a quick one for ya'

how do you tell (using vba) if there is an autoshape above your cusor, ie, activecell.range("A1").select ...... does it have a shape above it?

Ed??
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
How's this?

Sub trythis()
Dim sh As Object, flag As Boolean
Dim r1%, r2%, c1%, c2%, acr%, acc%

flag = False
acc = ActiveCell.Column
acr = ActiveCell.Row
For Each sh In ActiveSheet.Shapes
r1 = sh.TopLeftCell.Row
r2 = sh.BottomRightCell.Row
c1 = sh.TopLeftCell.Column
c2 = sh.BottomRightCell.Column
If (r1 <= acr And r2 >= acr And c1 <= acc And c2 >= acc) Then
MsgBox "Autoshape " & sh.Name & " is over this cell"
flag = True
End If
Next sh
If Not (flag) Then MsgBox "No Autoshapes at this cell."
Set sh = Nothing
End Sub
 
Upvote 0
I like this... elegant yet simple...

another of those, why didn't I think of that ..

just to add an aditional question to the forum,

If you have a timeline with filled autoshapes representing the location of a gas turbine, the rectangles are added by selecting a range and finding its locatin and size (top, left, height and width functoins) but it would be nice to update the rectangles so that if they were coded with some tag or another they automaticaly extended their length with the month....

is this one asking too much??

Ed...?
 
Upvote 0

Forum statistics

Threads
1,213,549
Messages
6,114,264
Members
448,558
Latest member
aivin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top