Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Delete Worksheets Named Sheet1, Sheet2, Sheet3, etc. | Excel Programming | |||
A1 in sheet1 =” =SUM('sheet2:sheet3'!A1)” | Excel Programming | |||
consoildate all the worksheet(example sheet1,sheet2 and sheet3 etc | Excel Worksheet Functions | |||
copy data from sheet1 based on criteria in sheet2 to sheet3 | Excel Programming | |||
user changes sheet1 - have the macro xyz run on sheet3 | Excel Programming |