I have an existing named range called 'MyRange' which is dynamic. I'd like to get a new named range using vba of all unique values in 'MyRange'. I'd prefer not to have the unique values listed anywhere in my spreadsheet.
Here is the code for the named range MyRange:
With Sort
k = Application.WorksheetFunction.CountA(ws1.Rows(1).EntireRow.Cells)
Set MyRange2 = ws1.Range(ws1.Cells(1, 2), ws1.Cells(1, k))
End With
Here is the code for the named range MyRange:
With Sort
k = Application.WorksheetFunction.CountA(ws1.Rows(1).EntireRow.Cells)
Set MyRange2 = ws1.Range(ws1.Cells(1, 2), ws1.Cells(1, k))
End With