ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Show all data (https://www.excelbanter.com/excel-programming/414927-show-all-data.html)

Mia

Show all data
 
Hi,

Do anyone know why this code don´t work?

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

//
Mia

AndrewArmstrong

Show all data
 
You need to set
activesheet.filtermode=true


Dave Peterson

Show all data
 
Maybe it's because you were filtering a list--not a range.

See your previous post.

Mia wrote:

Hi,

Do anyone know why this code don´t work?

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

//
Mia


--

Dave Peterson

Gary Keramidas

Show all data
 
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


"Mia" wrote in message
...
Hi,

Do anyone know why this code don´t work?

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

//
Mia




Mia

Show all data
 
Thank you again Dave!

//
Mia




"Dave Peterson" skrev:

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

See your previous post.

Mia wrote:

Hi,

Do anyone know why this code don´t work?

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

//
Mia


--

Dave Peterson



All times are GMT +1. The time now is 05:11 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com