ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Graphics question (https://www.excelbanter.com/excel-programming/420664-graphics-question.html)

Patrick C. Simonds

Graphics question
 
Is it possible to place a series of graphics (I have created 1 for each of
our allowed holidays) on a worksheet, and then using code copy the graphic
to another worksheet in the same workbook?

I have created a Template for our vacation calendar so we do not have
recreate it each year. When I start a new year I have conditional formatting
which removes all lines on the calendar for each of the holidays. Then I
want to paste the holidays graphic on the calendar. So say for Christmas I
have a graphic which is named Christmas.gif which I have inserted on a blank
(hidden) worksheet which I would copy to cell B44.

I envision having SheetActivation code which would look something like:

If range ("B60").value = "Christmas" Then

and then the code to copy the graphic Christmas from the hidden holiday
worksheet to cell B44 of the active worksheet.


JLGWhiz

Graphics question
 
Have you tried to copy it?

"Patrick C. Simonds" wrote:

Is it possible to place a series of graphics (I have created 1 for each of
our allowed holidays) on a worksheet, and then using code copy the graphic
to another worksheet in the same workbook?

I have created a Template for our vacation calendar so we do not have
recreate it each year. When I start a new year I have conditional formatting
which removes all lines on the calendar for each of the holidays. Then I
want to paste the holidays graphic on the calendar. So say for Christmas I
have a graphic which is named Christmas.gif which I have inserted on a blank
(hidden) worksheet which I would copy to cell B44.

I envision having SheetActivation code which would look something like:

If range ("B60").value = "Christmas" Then

and then the code to copy the graphic Christmas from the hidden holiday
worksheet to cell B44 of the active worksheet.



Patrick C. Simonds

Graphics question
 
Yes, it does not record what is being selected:


Sub Macro1()
'
' Macro1 Macro
'

'
Selection.Copy
Sheets("01 Jan 09").Select
Range("AJ22").Select
ActiveSheet.Paste
End Sub





"JLGWhiz" wrote in message
...
Have you tried to copy it?

"Patrick C. Simonds" wrote:

Is it possible to place a series of graphics (I have created 1 for each
of
our allowed holidays) on a worksheet, and then using code copy the
graphic
to another worksheet in the same workbook?

I have created a Template for our vacation calendar so we do not have
recreate it each year. When I start a new year I have conditional
formatting
which removes all lines on the calendar for each of the holidays. Then I
want to paste the holidays graphic on the calendar. So say for Christmas
I
have a graphic which is named Christmas.gif which I have inserted on a
blank
(hidden) worksheet which I would copy to cell B44.

I envision having SheetActivation code which would look something like:

If range ("B60").value = "Christmas" Then

and then the code to copy the graphic Christmas from the hidden holiday
worksheet to cell B44 of the active worksheet.




Peter T

Graphics question
 
Following should copy/paste to same position within topleftcell of the
source shape, not necessarily same left & top if row/column widths are
different on respective sheets (otherwise simply copy left/top properties of
source shape to the dest' shape). No sheet or shape selection required.

Sub test()
Dim lt As Single, tp As Single
Dim rTL As Range
Dim shp As Shape

Set shp = ActiveWorkbook.Worksheets("Sheet1").Shapes("Christ mas")

With shp
Set rTL = .TopLeftCell
lt = .Left - rTL.Left
tp = .Top - rTL.Top
.Copy
End With

With ActiveWorkbook.Worksheets("Sheet2")
.Paste
Set rTL = .Range(rTL.Address)
With .Shapes(.Shapes.Count)
.Left = rTL.Left + lt
.Top = rTL.Top + tp
End With
End With

End Sub

Regards,
Peter T

"Patrick C. Simonds" wrote in message
...
Is it possible to place a series of graphics (I have created 1 for each of
our allowed holidays) on a worksheet, and then using code copy the graphic
to another worksheet in the same workbook?

I have created a Template for our vacation calendar so we do not have
recreate it each year. When I start a new year I have conditional
formatting which removes all lines on the calendar for each of the
holidays. Then I want to paste the holidays graphic on the calendar. So
say for Christmas I have a graphic which is named Christmas.gif which I
have inserted on a blank (hidden) worksheet which I would copy to cell
B44.

I envision having SheetActivation code which would look something like:

If range ("B60").value = "Christmas" Then

and then the code to copy the graphic Christmas from the hidden holiday
worksheet to cell B44 of the active worksheet.





All times are GMT +1. The time now is 06:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com