+ Reply to Thread
Results 1 to 3 of 3

Command Button to select from Autofilter

  1. #1
    Registered User
    Join Date
    04-19-2007
    Posts
    1

    Command Button to select from Autofilter

    Hi, I am struggling to work out why the following doesn't work:

    Private Sub CommandButton2_Click()
    Sheets("Sheet1").Select
    Range("f5").AutoFilter Field:=6, Criteria1:="Budget"
    End Sub


    As when I use a simple Macro to perform the same task (filter on "Budget") it works perfectly fine. As a Macro it looks like this:

    Sub Macro_1()

    Sheets("Sheet1").Select
    Range("f5").AutoFilter Field:=6, Criteria1:="Budget"
    End Sub


    Can anyone suggest a solution or reason? As all I need is a Command Button to select from the Autofilter

    Cheers

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480
    That's a good one,

    How does it not work??

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Dr_Mik,

    I am guessing from your code the Command Button is on a UserForm. If so you need to set the UserForm's ShowModal propertry to False.

    Sincerely,
    Leith Ross

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1