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
- Copy the below VBA Code by clicking on the copy box
- Open Microsoft Visual Basic for Applications window Developer Ribbon Tab > Visual Basic (Shortcut keys as follows for mac & windows)
- mac users fn + ⌥ [option] + F11Â
- windows users Alt + F11
- From the menu bar select Insert > Module and insert new Modules
- 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.
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?
Well in that case you need to add the check within the loop If the cell ISEMPTY then move it to the next sheet. I hope this logic will be helpful
Works like magic! This is exactly what I’m after. Thanks for sharing!
Thank You 😊
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.