
Tips.Net > ExcelTips Home > Graphics > Pasting a Graphic to Multiple Worksheets
Summary: Pasting a graphic into a worksheet is easy. Pasting the same graphic to a lot of worksheets is repetitious. Excel doesn’t make it easy to paste graphics to multiple worksheets, but you can use a macro or two to make the job much easier. (This tip works with Microsoft Excel 97, Excel 2000, Excel 2002, Excel 2003, and Excel 2007.)
Marty has a series of workbooks, some with as many as 50 worksheets. He needs to paste a graphic (a company logo) into the same spot on each worksheet. He tried to do this by selecting all the worksheets and then doing the pasting, but that didn't seem to work on multiple worksheets like regular editing does.
Marty is right; trying to paste a graphic when you have multiple worksheets selected doesn't work. When you try, Excel tells you that it cannot make the paste, but if you then select just a single worksheet you can paste quite nicely.
Instead, you need to use a macro to do the pasting. Assuming that the graphic has already been copied to the Clipboard, you can run a macro such as the following:
Sub InsertLogo1()
Dim shtSheet As Worksheet
Application.ScreenUpdating = False
For Each shtSheet In Worksheets
With shtSheet
.Activate
.Range("A1").Select
.Paste
End With
Next
Set shtSheet = Nothing
Application.ScreenUpdating = True
End Sub
The macro steps through each worksheet in the workbook and pastes the graphic into cell A1. If you want to use a different cell, then all you need to do is modify the line that selects the cell.
If you don't want to copy the graphic to the Clipboard ahead of time, you can use a macro such as the following to insert the graphic directly from an image file:
Sub InsertLogo2()
Dim strPath As String
Dim shtSheet As Worksheet
strPath = "C:\GraphicFolder\PictureName.bmp"
For Each shtSheet In Worksheets
shtSheet.Activate
Range("A1").Select
ActiveSheet.Pictures.Insert (strPath)
Next shtSheet
Set shtSheet = Nothing
End Sub
You can, of course, modify the path to the graphic file and the cell at which the file is pasted into the worksheets.
Tip #3222 applies to Microsoft Excel versions: 97 2000 2002 2003 2007
More Power! Expand your skills and make Excel really sing! It's all possible with macros. The best resource anywhere for macros is ExcelTips: The Macros. Check it out today!
You can put times into a worksheet, but then what? Need to do calculations with times? How about working with elapsed time? Don't be confused; learn how easy it can be. (more information...)
Ask an Excel Question
Make a Comment
ExcelTips FAQ
ExcelTips Premium
Beauty Tips
Bugs and Pests Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Money Tips
Organizing Tips
Pet Tips
Word2007 Tips
WordTips
Advertise on the
ExcelTips Site