How to fix this VBA macro so it would highlight a range like A1 to the last row of column N and then format it as a table.
The number of rows will always vary, so I can’t name specific row number but I also don’t want more rows than required so I just want it to go to the last row in column N that has data in a cell.
I’ve tried the following, but I know nothing about VBA. I just found a similar one online and attempted to modify it for my needs, but I get a runtime error.![]()
Sub MakeTable() Dim tbl As ListObject Dim rng As Range Set rng = Range("A1:A" & LastRowColumnN) Set tbl = ActiveSheet.ListObjects.Add(xlSrcRange, rng, , xlYes) tbl.TableStyle = "TableStyleMedium15" End Sub
Bookmarks