Sunday, July 26, 2015

How to Copy and Paste Excel Range as Picture in VBA

Excel VBA Macro to Copy an Excel Range as Picture and Pasting as Picture
Sub Copy_Paste_As_Picture()
'Method -I : Copying the Range as Picture and Pasting
'Selecting and Copying the Range
'ActiveSheet.Range(MyRange).Select

'Copying as Picture , Best Usage Method: This will copy the Range in Excel without Background
    Selection.CopyPicture Appearance:=xlScreen, Format:=xlPicture

'Copying as Bit Map Image Method: This will copy the Range in Excel with Background
    Selection.CopyPicture Appearance:=xlScreen, Format:=xlBitmap

'Copying as Picture Print Method:
    Selection.CopyPicture Appearance:=xlPrinter, Format:=xlPicture

    ThisWorkbook.Sheets("MyTab").Activate
    ActiveSheet.Range("A5").Select
    ActiveSheet.Paste
    
'Method - II : Copying the Range and Pasting as Picture
'Selecting and Copying the Range
ActiveSheet.Range(MyRange).Select
Selection.Copy

    ThisWorkbook.Sheets("MyTab").Activate
    ActiveSheet.Range("A5").Select

'Pasting as Picture
    ActiveSheet.Pictures.Paste
'Pasting as Picture with Source Link (The Source Tab & Range Address of the Image in Excel)
    ActiveSheet.Pictures.Paste(Link:=True).Select
    
End Sub
--------------------------------------------------------------------------------------------------------
Thanks, TAMATAM ; Business Intelligence & Analytics Professional
--------------------------------------------------------------------------------------------------------

No comments:

Post a Comment

Hi User, Thank You for visiting My Blog. If you wish, please share your genuine Feedback or comments only related to this Blog Posts. It is my humble request that, please do not post any Spam comments or Advertising kind of comments, which will be Ignored.