![]() |
Picture name is changin as worksheet is copied
Hi,
This newsgroup is great, I've been using it frequently. Thank you My problem is that I'm using the code from http://www.mcgimpsey.com/excel/lookuppics.html to insert pictures in a worksheet according to a cell value, my chart is on a separate sheet to lookup the picture number, however when I copy the sheet, the pictures chage numbers, causing the wrong pictures to be called out. Any idea what is happening, I tried copying to new sheets with the test file that's on the McGimpsey site, and the picutes keep their corresponding number. Thanks in advance |
Picture name is changin as worksheet is copied
Indeed if you copy shapes (which include Pictures) to another sheet the
original Excel assigned name will change, to say Picture x. X increments with the number of shapes that have ever been added to the sheet since the sheet was saved with zero shapes.. Shapes have two names, the Excel assigned name and one that you can assign yourself, manually in the box on the input bar or with code. If you name the shape first, when you come to copy to another sheet myName will persist. So for your purposes name the Pictures before copying to other sheets. Be careful because for some strange reason Excel permits shapes with duplicate myName on the same sheet. Sub test() Dim pic As Picture For Each pic In ActiveSheet.Pictures i = i + 1 pic.Name = "myName_" & Format(i, "00") Next End Sub If by chance you had duplicate myNname's you might be surprised to find you need to run the above more than once. Regards, Peter T "Franky" wrote in message ... Hi, This newsgroup is great, I've been using it frequently. Thank you My problem is that I'm using the code from http://www.mcgimpsey.com/excel/lookuppics.html to insert pictures in a worksheet according to a cell value, my chart is on a separate sheet to lookup the picture number, however when I copy the sheet, the pictures chage numbers, causing the wrong pictures to be called out. Any idea what is happening, I tried copying to new sheets with the test file that's on the McGimpsey site, and the picutes keep their corresponding number. Thanks in advance |
All times are GMT +1. The time now is 02:37 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com