Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Trying to make some code that filters the unique rows in a range, but only
leaves the visible row, making it just as a normal range. So, no blue row numbers and continuous row numbering without gaps. Something like this will do it, but I think there must be a shorter more elegant way: Sub test() FilterUniqueInRange ActiveSheet, ActiveWindow.RangeSelection End Sub Sub FilterUniqueInRange(sh As Worksheet, rng As Range) Dim arr Dim shTemp sh.Activate rng.AdvancedFilter Action:=xlFilterInPlace, Unique:=True ActiveWindow.RangeSelection.Copy Set shTemp = ActiveWorkbook.Sheets.Add(after:=Worksheets(Worksh eets.Count)) shTemp.Name = "tempPaste" shTemp.Activate ActiveSheet.Paste Application.CutCopyMode = False With sh .ShowAllData .Cells.Clear End With ActiveWindow.RangeSelection.Copy sh.Activate Cells(1).Select ActiveSheet.Paste Application.CutCopyMode = False Application.DisplayAlerts = False shTemp.Delete Application.DisplayAlerts = True End Sub RBS |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copy only visible cells after filter is applied/ sum after filter | Excel Worksheet Functions | |||
Sumif for Visible range when using filter | Excel Discussion (Misc queries) | |||
unique filter results in some non-unique records. | Excel Discussion (Misc queries) | |||
Sum Unique Values Across SpecialCellType Visible Range. | Excel Programming | |||
Count unique visible records | Excel Programming |