Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
GLT GLT is offline
external usenet poster
 
Posts: 12
Default Auto-Filter on multiple worksheets automatically via VBA

Hi,

I am trying to use VBA to select 4 worksheets and run an Autofilter in
Column H (column # 8) on each sheet.

Each sheet is labelled from Jobsheet 1 ... 4.

The Autofilter criteria is "ALL" or myDay1

myDay1 = variable which contains the first 2 letters of the day (ie. MO TU WE)

When I run this code, I get a runtime error 13. Can anyone tell what I am
doing wrong or a better way to write this code?

For daLoop = 1 To 4

jobStream = "Jobstream " & daLoop
MsgBox jobStream

Sheets(jobStream).Select
Selection.AutoFilter Field:=8, Criteria1:="ALL" Or myDay1

Next daLoop

Cheers,
GLT


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Auto-Filter on multiple worksheets automatically via VBA

apply the two filters to your range (using the custom option) with the macro
recorder turned on. It will show you how to do it.

--
Regards,
Tom Ogilvy


"GLT" wrote in message
...
Hi,

I am trying to use VBA to select 4 worksheets and run an Autofilter in
Column H (column # 8) on each sheet.

Each sheet is labelled from Jobsheet 1 ... 4.

The Autofilter criteria is "ALL" or myDay1

myDay1 = variable which contains the first 2 letters of the day (ie. MO TU

WE)

When I run this code, I get a runtime error 13. Can anyone tell what I am
doing wrong or a better way to write this code?

For daLoop = 1 To 4

jobStream = "Jobstream " & daLoop
MsgBox jobStream

Sheets(jobStream).Select
Selection.AutoFilter Field:=8, Criteria1:="ALL" Or myDay1

Next daLoop

Cheers,
GLT




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
Auto Filter - Multiple Conditions? Ken Excel Discussion (Misc queries) 2 August 27th 09 06:31 PM
auto filter on multiple rows Jane Excel Worksheet Functions 1 June 8th 07 07:48 PM
automatically filter out blanks in multiple columns gmr7 Excel Worksheet Functions 2 June 3rd 05 07:36 PM
Auto Filter Multiple Selections sbrimley Excel Discussion (Misc queries) 5 May 2nd 05 07:32 PM
Multiple ranges to Auto Filter Kevin B[_4_] Excel Programming 1 June 30th 04 03:08 AM


All times are GMT +1. The time now is 04:44 PM.

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"