#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,814
Default showall not working

Why doesn't this work?

Sub showall()
'
Dim sh As Worksheet
'
Application.Calculation = xlManual
For Each sh In ThisWorkbook.Worksheets
sh.Activate
ActiveSheet.ShowAllData
Next sh
Application.Calculation = xlAutomatic
End Sub

I recorded a macro on a single sheet to show all data and it returned
"activesheet.showalldata". What I'm trying to do is to scroll through every
worksheet in a workbook and show all if there is a filter on the page.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default showall not working

If there is no filter on the worksheet, then it'll fail.

If a worksheet is protected, then it'll fail.

Sub showall()
'
Dim sh As Worksheet
'
Application.Calculation = xlManual
For Each sh In ThisWorkbook.Worksheets
'no need to select
If sh.FilterMode Then
sh.ShowAllData
End If
Application.Calculation = xlAutomatic
End Sub

Steve wrote:

Why doesn't this work?

Sub showall()
'
Dim sh As Worksheet
'
Application.Calculation = xlManual
For Each sh In ThisWorkbook.Worksheets
sh.Activate
ActiveSheet.ShowAllData
Next sh
Application.Calculation = xlAutomatic
End Sub

I recorded a macro on a single sheet to show all data and it returned
"activesheet.showalldata". What I'm trying to do is to scroll through every
worksheet in a workbook and show all if there is a filter on the page.


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,814
Default showall not working

I found out the problem. If there's not an autofilter on a given sheet, the
macro bombs. Is there a way to tell whether an autofilter exists? I want to
only show all data...not remove the autofilter.
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,814
Default showall not working

Thank you.

"Dave Peterson" wrote:

If there is no filter on the worksheet, then it'll fail.

If a worksheet is protected, then it'll fail.

Sub showall()
'
Dim sh As Worksheet
'
Application.Calculation = xlManual
For Each sh In ThisWorkbook.Worksheets
'no need to select
If sh.FilterMode Then
sh.ShowAllData
End If
Application.Calculation = xlAutomatic
End Sub

Steve wrote:

Why doesn't this work?

Sub showall()
'
Dim sh As Worksheet
'
Application.Calculation = xlManual
For Each sh In ThisWorkbook.Worksheets
sh.Activate
ActiveSheet.ShowAllData
Next sh
Application.Calculation = xlAutomatic
End Sub

I recorded a macro on a single sheet to show all data and it returned
"activesheet.showalldata". What I'm trying to do is to scroll through every
worksheet in a workbook and show all if there is a filter on the page.


--

Dave Peterson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ZERO VALUE NOT WORKING Gator Girl Excel Discussion (Misc queries) 2 August 29th 07 07:06 PM
I did have this working but I want to know how G Nisbet Excel Discussion (Misc queries) 1 June 22nd 07 02:38 PM
Add-ins not working [email protected] Links and Linking in Excel 2 March 20th 07 03:20 AM
if not working Micayla Bergen Excel Discussion (Misc queries) 3 March 13th 06 11:03 PM
F4 Key not working.... Calvin Excel Discussion (Misc queries) 2 July 29th 05 09:03 AM


All times are GMT +1. The time now is 10:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"