Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Selecting and cutting unknown picture numbers from a specifc range of cells

I have a range of cells B5:H5. Each has a different picture in it but
the picture numbers vary and change on a regular basis.

I need to write a macro that will select all seven pictures (1 per
cell) so I can cut or delete them. I can't say to select or cut a
specific picture number from the cell because as I said, they change
on regular basis and are not constant. The constant is the cell
reference. Any assistance is greatly appreciated.

Don

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Selecting and cutting unknown picture numbers from a specifc range of cells

Since pictures exist in the drawing layer, not in cells, you can't use
the cell references directly. However, if all your pictures fit *over*
(or in front of, depending on your perspective) those cells, this may
work:


Public Sub DeleteSomePictures()
Dim rDeleteCells As Range
Dim pic As Picture

Set rDeleteCells = Sheets("Sheet1").Range("B5:H5")
For Each pic In rDeleteCells.Parent.Pictures
With pic
If Not Intersect(.TopLeftCell, rDeleteCells) Is Nothing Then _
.Delete
End With
Next pic
End Sub



In article .com,
wrote:

I have a range of cells B5:H5. Each has a different picture in it but
the picture numbers vary and change on a regular basis.

I need to write a macro that will select all seven pictures (1 per
cell) so I can cut or delete them. I can't say to select or cut a
specific picture number from the cell because as I said, they change
on regular basis and are not constant. The constant is the cell
reference. Any assistance is greatly appreciated.

Don

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Selecting and cutting unknown picture numbers from a specifc range of cells

On Oct 29, 11:21 am, JE McGimpsey wrote:
Since pictures exist in the drawing layer, not in cells, you can't use
the cell references directly. However, if all your pictures fit *over*
(or in front of, depending on your perspective) those cells, this may
work:

Public Sub DeleteSomePictures()
Dim rDeleteCells As Range
Dim pic As Picture

Set rDeleteCells = Sheets("Sheet1").Range("B5:H5")
For Each pic In rDeleteCells.Parent.Pictures
With pic
If Not Intersect(.TopLeftCell, rDeleteCells) Is Nothing Then _
.Delete
End With
Next pic
End Sub

In article .com,



wrote:
I have a range of cells B5:H5. Each has a different picture in it but
the picture numbers vary and change on a regular basis.


I need to write a macro that will select all seven pictures (1 per
cell) so I can cut or delete them. I can't say to select or cut a
specific picture number from the cell because as I said, they change
on regular basis and are not constant. The constant is the cell
reference. Any assistance is greatly appreciated.


Don- Hide quoted text -


- Show quoted text -


That worked great. Is there a way to select the seven pictures, again
not knowing the picture numbers and moving them to another cell?
Example, I have just used your last reference to clear the cell (or
layer) for cells (B5:H5). I know want to select the pictures from
(B13:H13) and move them from (B13:H13) to the now empty (B5:H5).

Thanks as always for your tremendous assistance.

Don

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Selecting and cutting unknown picture numbers from a specifc range of cells

One way:

Public Sub TransferSomePictures()
Dim pic As Picture
Dim rFrom As Range
Dim rTo As Range
Dim rCell As Range

With Sheets("Sheet1").Range("B13:H13")
For Each pic In .Parent.Pictures
If Not Intersect(pic.TopLeftCell, .Cells) Is Nothing Then _
pic.Top = .Offset(-8, 0).Top
Next pic
End With
End Sub


In article . com,
wrote:

That worked great. Is there a way to select the seven pictures, again
not knowing the picture numbers and moving them to another cell?
Example, I have just used your last reference to clear the cell (or
layer) for cells (B5:H5). I know want to select the pictures from
(B13:H13) and move them from (B13:H13) to the now empty (B5:H5).

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
Total cells when range is unknown FirstVette52 Excel Worksheet Functions 4 December 31st 08 06:41 PM
Changing Picture Number when cutting and pasting [email protected] Excel Programming 1 October 10th 07 03:56 PM
How can I get a count of specifc words in a range? Dr. Crowbar Excel Worksheet Functions 1 September 18th 07 06:43 AM
Identifying & Selecting an Unknown Range? Don G Excel Programming 4 March 29th 06 08:59 PM
Excel VBA Highlighting/selecting an unknown range of cells daniB[_3_] Excel Programming 2 January 22nd 04 05:59 PM


All times are GMT +1. The time now is 11:39 PM.

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

About Us

"It's about Microsoft Excel"