+ Reply to Thread
Results 1 to 6 of 6

creating "Find" button on userform for editing data

  1. #1
    Registered User
    Join Date
    04-28-2009
    Location
    UK
    MS-Off Ver
    Excel 2000
    Posts
    38

    creating "Find" button on userform for editing data

    I've created a userform following the tutorial http://msdn.microsoft.com/en-us/library/aa192538.aspx

    And a Find button which reads a string from a textbox, searches for it on the worksheet, and then displays the data for that row in the userform.

    I'm trying to work out how to do "Find Next", and it seems complicated. I know there are other techniques, such as filtering, or displaying all the found data in a dialog for user to choose which one to edit. But these are not suitable for my project.

    Here's the code for my Find button

    Please Login or Register  to view this content.
    So, is there a good way of doing "Find Next"? I use Excel 2000.
    Last edited by madhg; 05-11-2009 at 02:22 PM. Reason: forgot to give version no.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: creating "Find" button on userform for editing data

    Taake a look at the databaseform here

    http://www.excel-it.com/vba_examples.htm
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    04-28-2009
    Location
    UK
    MS-Off Ver
    Excel 2000
    Posts
    38

    Re: creating "Find" button on userform for editing data

    Quote Originally Posted by royUK View Post
    Take a look at the databaseform here

    http://www.excel-it.com/vba_examples.htm
    Thanks for your reply. I have looked at the data form on that website, which I knew about because you regularly point users to it. The data form uses a filter, which in my case I don't want, as I mentioned in my post.

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: creating "Find" button on userform for editing data

    I can't see why a filter is not suitable, maybe if you attach your workbook

  5. #5
    Registered User
    Join Date
    04-28-2009
    Location
    UK
    MS-Off Ver
    Excel 2000
    Posts
    38

    Re: creating "Find" button on userform for editing data

    I thought about this and eventually worked out how to do it.

    I'm searching one column. A public variable StartSearch holds the row number of the cell where .Find found the given text. Then the next search starts from that cell. So pressing the Find button repeatedly cycles through all occurrences of the given text. That works fine for me.

    The user enters the string to search for in a textbox tbxFindText and then presses button Find.

    Please Login or Register  to view this content.
    Last edited by madhg; 05-11-2009 at 04:36 AM. Reason: realised there were no indents in the code because I'd used the wrong wrapping code

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: creating "Find" button on userform for editing data

    AutoFilter would be faster

+ 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