Hello,
I recently inherited a spreadsheet my team uses to keep track of projects and assign them to team members. I found some things that almost worked but not quite.
I Would like to have rows of the table copied from the main list of all projects to other sheets based on different statuses. I have created a macro that does this. However, I would like for the newly copied sheet to be formatted as a table. Since the amount of data changes I cannot simply pick a range to format as table I am attaching a sample workbook and part of the code. If any one could help I would really appreciate it. Also any help making the code look nicer would be helpful for future modifications as well.
Sub Filter_Copy_To_New_Request()
'
' Copto_New_Requests_Macro
'
'Clear Old Table'
Set Rng = Range("New_Requests[#All]")
Rng.ClearContents
'Copy Wanted Data To New Request sheet'
Sheets("All_Projects").Range("All_Projects[#All]") _
.AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Range("New_Requests!Criteria"), _
CopyToRange:=Range("A2"), _
Unique:=False
'Format data as Table'
Dim NR As Worksheet
Set NR = Sheets("New_Requests")
Set Col = Range(Selection, Selection.End(xlToRight))
Set Row = Range(Selection, Selection.End(xlDown))
NR.ListObjects.Add(xlSrcRange, Range("$A$2:$O$4"), , xlYes) _
.Name = "New_Requests"
Set NRA = Range("New_Requests[#All]")
ActiveSheet.ListObjects("New_Requests").TableStyle = "TableStyleMedium7"
End Sub
Thanks,
Dan
Bookmarks