Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / March 2008

Tip: Looking for answers? Try searching our database.

Delete multiple pictures on top of a range?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
fedude - 01 Mar 2008 22:51 GMT
With the enormous help of this forum I created a routine to copy a single
picture multiple times on top of a 10x14 range of cells (it's a golf
scorecard).   The picture is a large circle to identify which hole gets
strokes for handicaps.   I notice that every time I copy a picture it gets
the next "picture xxxx" sequence name.   Not sure if this is pertinent or not.

After I print the scorecard, I need to delete the pictures and start again.  
Does anyone know a way to delete pictures that happen to be laying on top of
a range?   With a mouse I manually can select the picture and hit "delete",
but how can I do this in a VB subroutine that I can call from my macro?
fedude - 01 Mar 2008 23:17 GMT
Nevermind...   I found the answer in a previous post.    Should have looked
more thoroughly

==================

Sub ClearScorecard()

Dim s As String
Dim pic As Picture
Dim rng As Range

' Set ws = ActiveSheet
Set ws = ActiveWorkbook.Worksheets("Sheet1")
Set rng = ws.Range("A20:J39")

For Each pic In ActiveSheet.Pictures
   With pic
       s = .TopLeftCell.Address & ":" & .BottomRightCell.Address
   End With
   If Not Intersect(rng, ws.Range(s)) Is Nothing Then
       pic.Delete
   End If
Next
End Sub

=================================

> With the enormous help of this forum I created a routine to copy a single
> picture multiple times on top of a 10x14 range of cells (it's a golf
[quoted text clipped - 6 lines]
> a range?   With a mouse I manually can select the picture and hit "delete",
> but how can I do this in a VB subroutine that I can call from my macro?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.