PC Review


Reply
Thread Tools Rate Thread

Copy logo from sheet1 to new sheet3-10

 
 
Gregor
Guest
Posts: n/a
 
      31st Jan 2008
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 With Quote
 
 
 
 
Chip Pearson
Guest
Posts: n/a
 
      31st Jan 2008
If you know the name of the picture to copy, you can use code like:

' Copy the picture
Worksheets("Sheet1").Pictures("Picture1").CopyPicture
' 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" <(E-Mail Removed)> wrote in message
news:3e868d14-2767-4923-8021-(E-Mail Removed)...
> 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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy from sheet1 and sheet2 and append to sheet3 in different format Ivan Hung Microsoft Excel Programming 8 29th Dec 2009 05:34 PM
= Today()+1 into Sheet1, Sheet2, and Sheet3 Jazz Microsoft Excel Programming 2 5th Aug 2009 03:23 AM
A1 in sheet1 = =SUM('sheet2:sheet3'!A1) minrufeng Microsoft Excel Programming 1 22nd Feb 2006 07:02 PM
copy data from sheet1 based on criteria in sheet2 to sheet3 =?Utf-8?B?RnJlZA==?= Microsoft Excel Programming 3 25th May 2004 01:46 PM
user changes sheet1 - have the macro xyz run on sheet3 tegger Microsoft Excel Programming 1 17th Oct 2003 09:28 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:25 AM.