• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

excel table paste special as picture in excel itself

Vishu Monga

New Member
Hi,
I want to create a macro VBA button (in sheet no.1) for different table which is in sheet number 2 and I have created about 50 tables (name table1, table2.... and so on in define name) in sheet no.2 and want to display it as a image/picture in sheet no.1 by clicking on the button.
please suggest what will be the easy method to do it.
 
Last edited:
Code:
Sub LoopThroughAllTablesInWorksheet()

'PURPOSE: Loop through and apply a change to all Tables in the Active Excel Sheet
'SOURCE: www.TheSpreadsheetGuru.com/the-code-vault
'Modified by Chirayu Walawalkar 25-Jun-2015

Dim FrstCell As String

Worksheets("Sheet2").Select

Dim tbl As ListObject

'Loop through each table in activesheet
  For Each tbl In ActiveSheet.ListObjects
  
  'Do something to all the tables...
  Range(tbl).Select
  ActiveCell.Offset(-1, 0).Select
  FrstCell = ActiveCell.Address
  Range(Selection, Selection.End(xlToRight)).Select
  Range(Selection, Selection.End(xlDown)).Select
  Selection.Copy
  Worksheets("Sheet1").Select
  Range(FrstCell).Select
  ActiveSheet.Pictures.Paste
  Worksheets("Sheet2").Select
  
  Next tbl

End Sub
 
Back
Top