simple looping question
Hi
This worked for me
Sub unique()
Dim ws As Worksheet
For Each ws In Worksheets
ws.UsedRange.AdvancedFilter Action:=xlFilterInPlace,
unique:=True
Next
End Sub
Sub ununique()
Dim ws As Worksheet
For Each ws In Worksheets
ws.ShowAllData
Next
End Sub
this was tested on two sheets which had the data
Name
Paul
John
Paul
in column A. Perhaps your problem is with the data? Do your columns
have headers?
regards
Paul
Person wrote:
I have what I hope is a simple looping question: I'm trying to
filter each of many worksheets in a workbook for the unique values
in a particular column, and then "unfilter" the whole workbook. My
"unique" function enters an infinite loop, I think. Any clues?
Sub unique()
Dim ws As Worksheet
For Each ws In Worksheets
'Columns("B:B").Select
ws.UsedRange.AdvancedFilter Action:=xlFilterInPlace, unique:=True
Next
End Sub
Sub ununique()
Dim ws As Worksheet
For Each ws In Worksheets
ActiveSheet.ShowAllData
Next
End Sub
|