Try running this after importing your new data...........
Don't forget to change the sheet/range references to suit your database
Sub JMJ123()
Dim LastRow As Long
Sheet1.Range("A2:J2").Select '<--- Format Template (1st data row)
Selection.Copy
LastRow = Sheet1.Cells(Rows.Count, "A").End(xlUp).Row
Sheet1.Range("A2:A" & LastRow).PasteSpecial Paste:=xlPasteFormats
Range("A1").Select
Application.CutCopyMode = False
End Sub
Note that the above makes it look like a table but doesn't actually define it to Excel as such
To do that you want code like the following
Sub Macro2()
Dim LastRow As Long
LastRow = Sheet1.Cells(Rows.Count, "A").End(xlUp).Row
Range("A1:J" & LastRow).Select
ActiveSheet.ListObjects.Add(xlSrcRange, Range("$A$1:$J$" & LastRow), , xlYes).Name = "Table1"
Range("Table1[#All]").Select
ActiveSheet.ListObjects("Table1").TableStyle = "TableStyleLight8"
Range("A1").Select
End Sub
Bookmarks