User Profile
redhandler
Copper Contributor
Joined 6 years ago
User Widgets
Recent Discussions
Update Macro to auto capture cell range and table name
Hi everyone, Newbie here. (Office 365, Windows 10 user) I run a lot of report on Excel files, and want to automatically create and format the cell range as a table and apply a table style. However the macro I record and want to use for this limits the cell range to the spreadsheet cell range for which I record it. This cell range will vary for different Excel spreadsheets. The other thing it does is include the 'Table2' name (as it was the second document I had open). Is there an edit I can make to the recorded Macro to automatically capture the cell range and name of table? Thanks so much. Sub Report1_Weekly() ' ' Weekly Report ' ' Range("A1").Select Application.CutCopyMode = False ActiveSheet.ListObjects.Add(xlSrcRange, Range("$A$1:$F$6"), , xlYes).Name = _ "Table2" Range("Table2[#All]").Select ActiveSheet.ListObjects("Table2").TableStyle = "TableStyleLight8" Selection.Rows.AutoFit Selection.Columns.AutoFit End Sub3.5KViews0likes7Comments
Recent Blog Articles
No content to show