Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 16
Default Bypass a function in a Macro

I am building a Macro that can run on a worksheet training matrix whether if
is filtered or not. It works beautifully as long as the file is filtered but
need to work both ways.

Here is the text I have for my macro so far

Sheets("Tech Plan").Select
ActiveSheet.Unprotect ("MPT8883900")
ActiveSheet.ShowAllData
ActiveSheet.Range("$A$10:$BO$569").AutoFilter Field:=53
ActiveSheet.Range("$A$10:$BO$569").AutoFilter Field:=53, Criteria1:="X"
ActiveSheet.Protect ("MPT8883900")

I am trying to bypass the ShowAllData line if it has already been
unfiltered. I have about 60 files to run this on and would appreciate any
help.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Bypass a function in a Macro

Could you not do something like

If ActiveSheet.FilterMode Then
ActiveSheet.ShowAllData
End If

--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.



"bevchapman" wrote:

I am building a Macro that can run on a worksheet training matrix whether if
is filtered or not. It works beautifully as long as the file is filtered but
need to work both ways.

Here is the text I have for my macro so far

Sheets("Tech Plan").Select
ActiveSheet.Unprotect ("MPT8883900")
ActiveSheet.ShowAllData
ActiveSheet.Range("$A$10:$BO$569").AutoFilter Field:=53
ActiveSheet.Range("$A$10:$BO$569").AutoFilter Field:=53, Criteria1:="X"
ActiveSheet.Protect ("MPT8883900")

I am trying to bypass the ShowAllData line if it has already been
unfiltered. I have about 60 files to run this on and would appreciate any
help.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,942
Default Bypass a function in a Macro

hi
read up on the filter mode property in vb help. it's boolean and true if
the sheet contains a filtered list.
to bypass the showalldata line, you would need something like this....
if activesheet.filtermode = true then
activesheet.showalldata
else
do something else '?????
end if

regards
FSt1

"bevchapman" wrote:

I am building a Macro that can run on a worksheet training matrix whether if
is filtered or not. It works beautifully as long as the file is filtered but
need to work both ways.

Here is the text I have for my macro so far

Sheets("Tech Plan").Select
ActiveSheet.Unprotect ("MPT8883900")
ActiveSheet.ShowAllData
ActiveSheet.Range("$A$10:$BO$569").AutoFilter Field:=53
ActiveSheet.Range("$A$10:$BO$569").AutoFilter Field:=53, Criteria1:="X"
ActiveSheet.Protect ("MPT8883900")

I am trying to bypass the ShowAllData line if it has already been
unfiltered. I have about 60 files to run this on and would appreciate any
help.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Bypass a function in a Macro

With worksheets("SomeSheetNameHere")
'to remove the filter and the arrows
.AutoFilterMode = False

'or to just show all the data and keep the arrows
If .FilterMode Then
.ShowAllData
End If
End With


Or you could ignore errors, too:

on error resume next
ActiveSheet.ShowAllData 'keeps the arrows, shows all the data.
on error goto 0

bevchapman wrote:

I am building a Macro that can run on a worksheet training matrix whether if
is filtered or not. It works beautifully as long as the file is filtered but
need to work both ways.

Here is the text I have for my macro so far

Sheets("Tech Plan").Select
ActiveSheet.Unprotect ("MPT8883900")
ActiveSheet.ShowAllData
ActiveSheet.Range("$A$10:$BO$569").AutoFilter Field:=53
ActiveSheet.Range("$A$10:$BO$569").AutoFilter Field:=53, Criteria1:="X"
ActiveSheet.Protect ("MPT8883900")

I am trying to bypass the ShowAllData line if it has already been
unfiltered. I have about 60 files to run this on and would appreciate any
help.


--

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
Bypass Auto-Open Procedure QB Excel Discussion (Misc queries) 1 October 6th 09 04:29 PM
Bypass Auto_open Macro in Excel 2007 BradJohnson Excel Discussion (Misc queries) 3 April 9th 09 05:28 PM
Import Text File Window Bypass tmwilkin Excel Discussion (Misc queries) 1 February 10th 09 11:00 PM
Bypass prompt to open XML file as XML list? Steve Vincent Excel Discussion (Misc queries) 0 March 13th 06 10:05 PM
any way to bypass Excel Limit of 255 rows? griff Charts and Charting in Excel 0 November 9th 05 04:18 PM


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

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

About Us

"It's about Microsoft Excel"