Convert All Sheets Data Into Excel Tables with VBA

This VBA Code allows you to convert all the sheets data into Excel Tables.

Video

Check out the video for easy demonstration

Subscribe to YouTube Channel for Exciting Tips & Tricks On Office Applications

You can use the code in Excel for mac & windows

  1. Copy the below VBA Code by clicking on the copy box
  2. Open Microsoft Visual Basic for Applications window Developer Ribbon Tab > Visual Basic (Shortcut keys as follows for mac & windows)
    1. mac users fn  + ⌥ [option] + F11 
    2. windows users Alt  + F11
  3. From the menu bar select Insert > Module and insert new Modules
  4. Paste the code into the module.

Note: It is always to take a back-up copy of your original before running the code on the original file.

Sub ConvertDataToTables()
  'ConvertDataToTables Macro, This Code will convert all the data in the Excel Worksheet to Excel Tables
  ' Made It Easy By ExcelExciting.com
  Dim i as Integer
    Sheets(1).Select
    
    For i = 1 To Sheets.Count
        Sheets(i).Activate
        Range("A1").CurrentRegion.Select
        If ActiveSheet.ListObjects.Count < 1 Then
            ActiveSheet.ListObjects.Add.Name = ActiveSheet.Name
        End If
    Next i
End Sub

Was the information helpful in this blog?

  • If yes, hit that share button and show the excitement to the world.
  • Subscribe to our free posts.

Join 2,924 other subscribers

If no, please let us know what to improve.

Having trouble with any Office Apps. Feel free to ask and answer queries at our forums section.


5 1 vote
Article Rating
Subscribe
Notify of
guest
5 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Kopano

How do I skip sheets that don’t have tables? Example, lets say I have 100 sheets and some of the sheets contain only “No data” in cell A4, how do I treat this in the VBA?

FHU

Works like magic! This is exactly what I’m after. Thanks for sharing!

julianoidf@gmail.com

HELLO!
Greatings from Brazil!!

Faraz it works great!!

Can u Help me to change the code to do same thing but starting the table data on “A2” , of all sheets?

Thanks in advanced.

5
0
Would love your thoughts, please comment.x
()
x