+ Reply to Thread
Results 1 to 10 of 10

filter through command button using textbox values

  1. #1
    Registered User
    Join Date
    03-29-2016
    Location
    cottbus, Germany
    MS-Off Ver
    2010
    Posts
    5

    filter through command button using textbox values

    Hello experts!!!!!!

    I am new to vba and I want to try out filtering data.

    I have columm which contains almost 40000 rows. basically it has Dates and months.

    I want two TextBox and three command Buttons to filter my data. 1st to filter according to month and then 2nd to filter according to date. 3rd button to get all data back.


    I can do it by using filter but i want to that by command.

    I have tried to filter according to month but wasn't sucessful.

    the code I used :

    Private Sub CommandButton21_Click()

    ' filter data
    '

    '
    Dim i As Date
    i = TextBox21.Value
    Range("A5").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.AutoFilter
    Range("A5").Select
    ActiveSheet.Range("$A$5:$A$35041").AutoFilter Field:=1, Operator:= _
    xlFilterValues, Criteria2:=Array(1, "i")
    End Sub


    Please help me out!!!!!

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: filter thriugh command button using textbox values

    You've got the macro, just add the activeX controls and link the macro.
    Once you record a macro you can use this.
    I suggest you attach a sample file with non-sensitive data, 100 rows of data is enough for the basic functionality
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Registered User
    Join Date
    03-29-2016
    Location
    cottbus, Germany
    MS-Off Ver
    2010
    Posts
    5

    Re: filter thriugh command button using textbox values

    here is a sample file
    Attached Files Attached Files

  4. #4
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: filter through command button using textbox values

    Okay, got the file. I'll take a look and see if I can help you with this

  5. #5
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: filter through command button using textbox values

    A question: you mention you want to filter by month and then by date, what is the difference?
    Or do you mean by day of the week or by day?
    Once you filter by month it's a date filter too. Could you be a little more specific

  6. #6
    Registered User
    Join Date
    03-29-2016
    Location
    cottbus, Germany
    MS-Off Ver
    2010
    Posts
    5

    Re: filter through command button using textbox values

    first of all thanks for respponding.

    I have a data for all 365 days at interval of 15 min time. So at first I want to get data for a particular month and then from that month I want data for any date. As you can see in file there are many entries with similar date. it is just a sample sir as I can not share full data. I hope this clarify your query.

  7. #7
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: filter through command button using textbox values

    Okay, clear. You will have to give me a little time.
    Bis später.

  8. #8
    Registered User
    Join Date
    03-29-2016
    Location
    cottbus, Germany
    MS-Off Ver
    2010
    Posts
    5

    Re: filter through command button using textbox values

    no Problem sir!!!!
    Bis später

  9. #9
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: filter through command button using textbox values

    Here is what I could do for you
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    03-29-2016
    Location
    cottbus, Germany
    MS-Off Ver
    2010
    Posts
    5

    Re: filter through command button using textbox values

    thank you very much sir!!!!!

    It was a great help.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Hyperlink text in textbox using command button
    By ANARDIL1986 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-19-2015, 04:08 PM
  2. [SOLVED] Help With Using Option Button and Textbox with A Command Button
    By VBTroubles in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-02-2014, 09:40 AM
  3. [SOLVED] Command Button when pressed will incurease textbox value
    By Gal403 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-08-2014, 01:50 AM
  4. [SOLVED] Command Button to add +1 to Textbox;
    By Gal403 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-06-2013, 03:55 AM
  5. Replies: 3
    Last Post: 05-07-2012, 09:46 PM
  6. for loop with textbox and command button
    By st0kvis in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-21-2011, 04:33 AM
  7. Adding a textbox via command button
    By NewExcelUser in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-22-2006, 12:49 PM

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