Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I have a variable range that I would like to filter for unique values. I am having trouble defining the range and get a runtime error 1004, reference is not valid. I copy the field from a database to another sheet and would like to apply the filter to just that range to get the uniquie values. Code: Sub FilterUniqueValues() Dim CostCentre As Range Sheets("Data").Select 'Data sheet containing database Range("C1").Select 'top cell of field to copy Range(Selection, Selection.End(xlDown)).Select 'select field Selection.Copy Sheets("Criteria").Select 'move to second sheet Range("M2").Select 'paste cell for copied field ActiveSheet.Paste Application.CutCopyMode = False Set CostCentre = Selection 'set range to coped field 'filter for unique values CostCentre.AdvancedFilter xlFilterCopy, "I2:I3", "o2", True End Sub thanks for any help Jake |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Building criteria string for Advanced Filter variable not resolvin | Excel Discussion (Misc queries) | |||
Advanced Filter VB Script for Variable Criteria Range | Excel Programming | |||
advanced filter a range | Excel Worksheet Functions | |||
"Criteria Range" in the "Data/Filter/Advanced Filter" to select Du | Excel Worksheet Functions | |||
Advanced Filter & Named Range | Excel Programming |