+ Reply to Thread
Results 1 to 9 of 9

Filter Macro, Search and set worksheet does not work

  1. #1
    Registered User
    Join Date
    04-12-2013
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    12

    Filter Macro, Search and set worksheet does not work

    Hi,

    I am new to excelforum but I regularly check the threads for tutorials and more information on userforms. I an currently creating an Workbook with userform that will accept data and create a database. I was able to create this userform using the resources in the web but since I have no VBA background, it is kinda hard to troubleshoot. Currently, I can add information to the userform, and hide/show the excel file.

    The problem now is that the search function does not work. The filter function does not work. And if I use the "set ws" function, it won't focus on one worksheet when I use activecell function. I use activecell since I don't know any simplier way of creating a search function. Please help. I attached my file below.

    Logger.xlsm

    Thanks,

  2. #2
    Forum Contributor
    Join Date
    01-07-2013
    Location
    south africa
    MS-Off Ver
    Excel 2003-13
    Posts
    210

    Re: Filter Macro, Search and set worksheet does not work

    Hello there
    What referring to your search function, do you mean the filter button on the userform (ToggleButton2) ?
    You need to go back to your data sheet as it is not picking up anything on the active sheet - which is sheet1

    Try:
    Please Login or Register  to view this content.
    and you can also replace the activesheet. with Sheets(1).

    Obviously instead of 1 you can use the actual name sheets("FormsTest"), just trying to convey the principle rather than semantics.

    Regards
    Most helpful to mark solved items as such (see help for directions). Star ratings are always welcome.

  3. #3
    Registered User
    Join Date
    04-12-2013
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Filter Macro, Search and set worksheet does not work

    Awesome! It worked! Thank you so much!

    Any idea why won't it stay on FormsTest when using ActiveSheet?

  4. #4
    Forum Contributor
    Join Date
    01-07-2013
    Location
    south africa
    MS-Off Ver
    Excel 2003-13
    Posts
    210

    Re: Filter Macro, Search and set worksheet does not work

    Hello
    The button is on sheet 2, so when you go there to press the button, the active sheet becomes sheet2

    Regards

  5. #5
    Registered User
    Join Date
    04-12-2013
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Filter Macro, Search and set worksheet does not work

    I tried Set ws = FormsTest and still does not work. How do I make it focus on one worksheet?

  6. #6
    Forum Contributor
    Join Date
    01-07-2013
    Location
    south africa
    MS-Off Ver
    Excel 2003-13
    Posts
    210

    Re: Filter Macro, Search and set worksheet does not work

    Hello there
    The data is entered in FormsTest. When you set ws = FormsTest, that value does get set and used.
    What are you trying to do ?

  7. #7
    Registered User
    Join Date
    04-12-2013
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Filter Macro, Search and set worksheet does not work

    Hi,

    I was trying to use ActiveCell.Offset instead of ws.Cells. Since it is easier to create a search function using ActiveCell. I have another version wherein when you enter the data, it uses the ActiveCell function. I tried to incorporate ws.Cells only because Set ws function does not work.

  8. #8
    Forum Contributor
    Join Date
    01-07-2013
    Location
    south africa
    MS-Off Ver
    Excel 2003-13
    Posts
    210

    Re: Filter Macro, Search and set worksheet does not work

    Hello

    So do you need to search for 1 or more fields from the data that is entered in the FormsTest ? There are functions such as
    Find
    FindNext
    which can be used on ranges. This may be easier that building your own search function and stepping through each record which would need the activecell, unless your search is using a different type of logic.

    Try those and see how it goes.

    I am have missed you on your requirement though and you are trying to do something different with the search.

    Regards

  9. #9
    Registered User
    Join Date
    04-12-2013
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Filter Macro, Search and set worksheet does not work

    The search function isn't really a normal search function. Let me give an example. Entries are from Product Number 1-100. The user inputs product number 79. The program searches a column for product number 79 and changes the data under it. Entering the product number will be the same as entering a new product number.

    I'll try those functions.

    Thank you, ham.

+ 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