Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Copy logo from sheet1 to new sheet3-10

Hi,

I distribute a workbook that has two sheets in it and I use VBA macros
to pull data in and format it on 7 new sheets.

I need to copy the logo from sheet 1 to the new sheets.

I've selected the picture on sheet 1 and named it as Logo (just like
you would name a range), but when I call Range("Logo").copy, I get a
range error.

If I use Range("A1:).copy I get an empty string.

I've use Activesheet.paste to paste the image.

I know I'm missing something, but I don't know what. Any ideas?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Copy logo from sheet1 to new sheet3-10

If you know the name of the picture to copy, you can use code like:

' Copy the picture
Worksheets("Sheet1").Pictures("Picture1").CopyPict ure
' Paste it into the appropriate sheet and range
Worksheets("Sheet2").Range("C10").PasteSpecial
' Remove focus from the shape. Optional.
Worksheets("Sheet2").Range("C10").Activate


If you don't know the name of the picture, you can use the following
function to return the (first) picture whose top left cell is within a
specified Range.

Function PictureOfRange(RefCell As Range) As Excel.Picture
Dim P As Excel.Picture
Dim WS As Worksheet
Set WS = RefCell.Worksheet
For Each P In WS.Pictures
If Not Application.Intersect( _
P.TopLeftCell, RefCell) Is Nothing Then
Set PictureOfRange = P
Exit Function
End If
Next P
End Function


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2008
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



"Gregor" wrote in message
...
Hi,

I distribute a workbook that has two sheets in it and I use VBA macros
to pull data in and format it on 7 new sheets.

I need to copy the logo from sheet 1 to the new sheets.

I've selected the picture on sheet 1 and named it as Logo (just like
you would name a range), but when I call Range("Logo").copy, I get a
range error.

If I use Range("A1:).copy I get an empty string.

I've use Activesheet.paste to paste the image.

I know I'm missing something, but I don't know what. Any ideas?


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
Delete Worksheets Named Sheet1, Sheet2, Sheet3, etc. ryguy7272 Excel Programming 7 April 6th 07 10:32 PM
A1 in sheet1 =” =SUM('sheet2:sheet3'!A1)” minrufeng[_12_] Excel Programming 1 February 22nd 06 07:02 PM
consoildate all the worksheet(example sheet1,sheet2 and sheet3 etc officeboy Excel Worksheet Functions 1 November 4th 04 04:16 PM
copy data from sheet1 based on criteria in sheet2 to sheet3 Fred Excel Programming 3 May 25th 04 01:46 PM
user changes sheet1 - have the macro xyz run on sheet3 tegger Excel Programming 5 October 17th 03 11:32 PM


All times are GMT +1. The time now is 09:54 AM.

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"