troubleshooting Question

Excel vba to create table

Avatar of PeterBaileyUk
PeterBaileyUk asked on
Microsoft Excel
6 Comments3 Solutions444 ViewsLast Modified:
I have a sub that populates a worksheet from an access query. How do I those rows  into a table using vba?

I found this but it wants a range and the range will change everytime its updated.

When I manually created the table i only needed to click in 1 cell of the data and excel knew the range automatically, so I need to do that action automatically.

 Sub CreateTable()
    Sheets("Pivot SMMT Raw").ListObjects.Add(xlSrcRange, Range("$A$1:$N$16"), , xlYes).Name = _
        'No go in 2003
    ActiveSheet.ListObjects("Table1").TableStyle = "TableStyleLight2"
End Sub
Join our community to see this answer!
Unlock 3 Answers and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros