Hello all. I see a lot of resources on removing duplicates but none to reference a table (list object.) The macro recorder grabs it, but I want to refer to the table name with a variable, should be able to be done. Any ideas? Thanks in advance...
Kevin
Kevin
Code:
Sub RemoveDuplicatesSub(WkSht)
'Remove duplicates.
'Assumes that the data range is in a table
'Assumes the header row starts at row 7, and that the date and number rows are skippped.
Dim WS As Worksheet
Dim TableName As String
Set WS = Worksheets(WkSht)
TableName = WS.Name & "Table"
[COLOR=blue]'This was recorded:[/COLOR]
'WS.Range("Table1[#All]").RemoveDuplicates Columns:=Array(3, 4, 5, 6, 7, 8, 9, 10), Header:=xlYes
[COLOR=#0000ff]'Here is what I'd like to do:[/COLOR]
WS.Range(TableName).RemoveDuplicates Columns:=Array(3, 4, 5, 6, 7, 8, 9, 10), Header:=xlYes
End Sub