Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default Mass Delete/Paste Graphics in a Workbook

I need a macro to assign to a control button on Sheet1 to:
1.) Delete the graphics in cells A11, B22, C33, ..., etc.
2.) Paste the graphics from:
Sheet3/cellP3 to Sheet1/cellA11,
Sheet4/cellG19 to Sheet1/cell B22
Sheet5/cellW32 to Sheet1/cell C33
etc.?
There will be about 70 of these delete/pastes (updates).
What would the code be?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Mass Delete/Paste Graphics in a Workbook

First, graphics are over cells, but they are not associated with the cells.

It would be much easier to name your graphics in some clever way that allows
you to loop through them using the name.

But given your premis,


you can loop through your shapes

Dim sh as Worksheet, sh1 as Worksheet
Dim v as Variant, v1 as Variant
Dim rng as Range, rng1 as Range
Dim shp as Shape, i as Long, j as Long
set sh = Worksheets("Sheet1")
set rng = sh.Range("A11, B22, C33")
for each shp in sh.Shapes
set rng1 = sh.range(sh.TopLeftCell, sh.BottomRightCell)
if not intersect(rng,rng1) is nothing then
shp.Delete
end if
Next
'
' now copy the shapes
'
v1 = Array("A11","B22","C33")
v = Array("P3","G19","W32")
j = lbound(v)
for i = 3 to 5
set sh1 = Worksheets("Sheet" & i)
set rng = sh1.Range(v(j))
for each shp in sh1.shapes
set rng1 = sh1.Range(shp.TopLeftCell, shp.BottomRightCell)
if not intersect(rng1,rng) is nothing then
shp.copy
sh.Select
sh.Range(v1(j)).Select
sh.Paste
exit for
end if
Next
j = j + 1
Next


--
Regards,
Tom Ogilvy


"Phil H" wrote in message
...
I need a macro to assign to a control button on Sheet1 to:
1.) Delete the graphics in cells A11, B22, C33, ..., etc.
2.) Paste the graphics from:
Sheet3/cellP3 to Sheet1/cellA11,
Sheet4/cellG19 to Sheet1/cell B22
Sheet5/cellW32 to Sheet1/cell C33
etc.?
There will be about 70 of these delete/pastes (updates).
What would the code be?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default Mass Delete/Paste Graphics in a Workbook

Tom,
Thanks for your reply. You mentioned naming the graphics €“ I have done just
that, but didnt know it could figure in the solution. There are 16 metafile
graphics (circles with different colors some with arrows some without). They
are pasted (by code) over the various cells in Sheet3, Sheet4,
Sheet5€¦Sheet14, and are named based on their descriptive nature and the fact
they are pasted. They are pasted by macro when the user clicks a duplicate
graphic with the same name without the word €śPaste.€ť in it. The pasted
graphic names a

RedSteadyPaste, RedImprovingPaste, RedDecliningPaste
RedYellowSteadyPaste, RedYellowImprovingPaste, RedYellowDecliningPaste
YellowSteadyPaste, YellowImprovingPaste, YellowDecliningPaste
GreenYellowSteadyPaste, GreanYellowImproving Paste, GreenYellowDecliningPaste
GreenSteadyPaste, GreenImprovingPaste, GreenDecliningPaste
GraySteadyPaste

The source cells in sheets 3-14 will always be the same, (a revision from my
first question) ie,
Sheet3, cells B3, B13, B23, and B33 hold the graphics to be pasted into Sheet1
Sheet4, cells B3, B13, B23, and B33 hold the graphics to be pasted into Sheet1
Etc€¦.
Sheet14, cells B3, B13, B23, and B33 hold the graphics to be pasted into
Sheet1

On the basis of this information, should the code be reconstructed?

In the code, how will the linkage be made between the specific cell in
Sheet1, and its associated cell in, say, Sheet9?

Thanks, Phil


"Tom Ogilvy" wrote:

First, graphics are over cells, but they are not associated with the cells.

It would be much easier to name your graphics in some clever way that allows
you to loop through them using the name.

But given your premis,


you can loop through your shapes

Dim sh as Worksheet, sh1 as Worksheet
Dim v as Variant, v1 as Variant
Dim rng as Range, rng1 as Range
Dim shp as Shape, i as Long, j as Long
set sh = Worksheets("Sheet1")
set rng = sh.Range("A11, B22, C33")
for each shp in sh.Shapes
set rng1 = sh.range(sh.TopLeftCell, sh.BottomRightCell)
if not intersect(rng,rng1) is nothing then
shp.Delete
end if
Next
'
' now copy the shapes
'
v1 = Array("A11","B22","C33")
v = Array("P3","G19","W32")
j = lbound(v)
for i = 3 to 5
set sh1 = Worksheets("Sheet" & i)
set rng = sh1.Range(v(j))
for each shp in sh1.shapes
set rng1 = sh1.Range(shp.TopLeftCell, shp.BottomRightCell)
if not intersect(rng1,rng) is nothing then
shp.copy
sh.Select
sh.Range(v1(j)).Select
sh.Paste
exit for
end if
Next
j = j + 1
Next


--
Regards,
Tom Ogilvy


"Phil H" wrote in message
...
I need a macro to assign to a control button on Sheet1 to:
1.) Delete the graphics in cells A11, B22, C33, ..., etc.
2.) Paste the graphics from:
Sheet3/cellP3 to Sheet1/cellA11,
Sheet4/cellG19 to Sheet1/cell B22
Sheet5/cellW32 to Sheet1/cell C33
etc.?
There will be about 70 of these delete/pastes (updates).
What would the code be?




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Mass Delete/Paste Graphics in a Workbook

I don't see anything in the naming convention you have adapted that would be
particularly useful in performing the task.

So I would just provide the correct arguments to the arrays and see if it
works for you.

--
Regards,
Tom Ogilvy

"Phil H" wrote in message
...
Tom,
Thanks for your reply. You mentioned naming the graphics - I have done

just
that, but didn't know it could figure in the solution. There are 16

metafile
graphics (circles with different colors some with arrows some without).

They
are pasted (by code) over the various cells in Sheet3, Sheet4,
Sheet5.Sheet14, and are named based on their descriptive nature and the

fact
they are pasted. They are pasted by macro when the user clicks a

duplicate
graphic with the same name without the word "Paste." in it. The pasted
graphic names a

RedSteadyPaste, RedImprovingPaste, RedDecliningPaste
RedYellowSteadyPaste, RedYellowImprovingPaste, RedYellowDecliningPaste
YellowSteadyPaste, YellowImprovingPaste, YellowDecliningPaste
GreenYellowSteadyPaste, GreanYellowImproving Paste,

GreenYellowDecliningPaste
GreenSteadyPaste, GreenImprovingPaste, GreenDecliningPaste
GraySteadyPaste

The source cells in sheets 3-14 will always be the same, (a revision from

my
first question) ie,
Sheet3, cells B3, B13, B23, and B33 hold the graphics to be pasted into

Sheet1
Sheet4, cells B3, B13, B23, and B33 hold the graphics to be pasted into

Sheet1
Etc..
Sheet14, cells B3, B13, B23, and B33 hold the graphics to be pasted into
Sheet1

On the basis of this information, should the code be reconstructed?

In the code, how will the linkage be made between the specific cell in
Sheet1, and its associated cell in, say, Sheet9?

Thanks, Phil


"Tom Ogilvy" wrote:

First, graphics are over cells, but they are not associated with the

cells.

It would be much easier to name your graphics in some clever way that

allows
you to loop through them using the name.

But given your premis,


you can loop through your shapes

Dim sh as Worksheet, sh1 as Worksheet
Dim v as Variant, v1 as Variant
Dim rng as Range, rng1 as Range
Dim shp as Shape, i as Long, j as Long
set sh = Worksheets("Sheet1")
set rng = sh.Range("A11, B22, C33")
for each shp in sh.Shapes
set rng1 = sh.range(sh.TopLeftCell, sh.BottomRightCell)
if not intersect(rng,rng1) is nothing then
shp.Delete
end if
Next
'
' now copy the shapes
'
v1 = Array("A11","B22","C33")
v = Array("P3","G19","W32")
j = lbound(v)
for i = 3 to 5
set sh1 = Worksheets("Sheet" & i)
set rng = sh1.Range(v(j))
for each shp in sh1.shapes
set rng1 = sh1.Range(shp.TopLeftCell, shp.BottomRightCell)
if not intersect(rng1,rng) is nothing then
shp.copy
sh.Select
sh.Range(v1(j)).Select
sh.Paste
exit for
end if
Next
j = j + 1
Next


--
Regards,
Tom Ogilvy


"Phil H" wrote in message
...
I need a macro to assign to a control button on Sheet1 to:
1.) Delete the graphics in cells A11, B22, C33, ..., etc.
2.) Paste the graphics from:
Sheet3/cellP3 to Sheet1/cellA11,
Sheet4/cellG19 to Sheet1/cell B22
Sheet5/cellW32 to Sheet1/cell C33
etc.?
There will be about 70 of these delete/pastes (updates).
What would the code be?






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 can i delete excel temporary files en mass? cs103 Excel Discussion (Misc queries) 2 February 16th 09 05:37 PM
Delete mass rows from excel tnr1995 Excel Discussion (Misc queries) 2 May 27th 08 10:49 PM
Graphics won't delete from spreadsheet kevinla Excel Discussion (Misc queries) 3 November 21st 06 07:29 AM
Delete graphics copied from a Web page Jim Georgia Excel Discussion (Misc queries) 1 October 20th 05 02:47 PM
Excel/VB Copy/Paste of Graphics Dave Peterson[_3_] Excel Programming 0 August 28th 04 01:22 AM


All times are GMT +1. The time now is 09:32 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"