Show all data

  • Thread starter Thread starter Mia
  • Start date Start date
M

Mia

Hi,

Do anyone know why this code don´t work?

Sub ShowAllRecords()
If ActiveSheet.FilterMode Then
ActiveSheet.ShowAllData
End If
End Sub

//
Mia
 
Maybe it's because you were filtering a list--not a range.

See your previous post.
 
i've run into that problem if the autofilter is on, but no fields are actually
filtered. some the autofilter may be on and showalldata pops an error because
showalldata is true

to work around it, i use code like the 2 examples below. in the first instance,
i have the autofilter turned on for columns A:E. it checks to see if there are
any filtered columns, and if there is, it executes showalldata and exits.

If ws.AutoFilterMode = True Then
For i = 1 To 5
With ws.AutoFilter.Filters(i)
If .On Then
ws.ShowAllData
Exit For
End If

End With
Next
End If


you could probaby surround with on error statements, too.

on error resume next
ws.ShowAllData
on error got to 0

--






Gary
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top