Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default How do I code a button to filter on worksheet2

I have created a button on worksheet1 and I need code that will allow me
to run my filter for sheet2. I already have the filter code, but I need
code that will focus or run the filter for sheet2. here is the code I am
using that will run the filter it will work if I do it in sheet1 but I
have to open the file in sheet2 because it is a dbf file and because of
the buttons and so forth:
Dim iLastRow As Long
iLastRow = Cells(Rows.Count, "B").End(xlUp).Row
With Range("B1:B" & iLastRow)
.AutoFilter Field:=1, Criteria1:="SC"
.SpecialCells(xlCellTypeVisible).EntireRow.Copy _
Destination:=Worksheets("Sheet2").Range("A1")
.AutoFilter
.AutoFilter Field:=1, Criteria1:="SU"
.SpecialCells(xlCellTypeVisible).EntireRow.Copy _
Destination:=Worksheets("Sheet3").Range("A1")
.AutoFilter
End With

Thanks again to all that have helped out.


*** Sent via Developersdex http://www.developersdex.com ***
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
how to set a button to filter a table [email protected] Charts and Charting in Excel 0 February 18th 09 10:29 PM
How do I make worksheet2 = to worksheet1? otulp78 Excel Discussion (Misc queries) 2 January 4th 09 02:16 AM
Filter - Show All button Francesco Excel Discussion (Misc queries) 1 August 13th 08 07:00 PM
change position of filter button Jodie Excel Worksheet Functions 1 July 11th 06 10:07 PM
columns on worksheet2 don't sort with worksheet1 PatAlexander Excel Worksheet Functions 1 April 13th 06 02:24 PM


All times are GMT +1. The time now is 08:31 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"