+ Reply to Thread
Results 1 to 4 of 4

Database Search Form Help?

  1. #1
    Rumish8086
    Guest

    Database Search Form Help?

    My task is to make a form which does the following: It needs to search an
    Excel worksheet for a string of text entered by the user and then spit out a
    new worksheet with only rows containing that data.

    Seems like it should be very easy, but I am completely new to Excel and all
    of my attempts thus far have failed. I'm trying to learn some basic VBA as
    quick as I can, but some help would be absolutely wonderful.

    Basically, the way it should look is this: there should be a box which asks
    for text, let's call this SearchString. And then there should be a button
    beneath it that begins the search process (let's call this SearchStart).
    After pressing the SearchStart button, the user should see all rows
    containing the previously-entered SearchString in a new worksheet.

    Easy as that, but I don't know where to begin. Can someone help?

    Thanks!

  2. #2
    RB Smissaert
    Guest

    Re: Database Search Form Help?

    What is the problem you are having?
    To get the string to search for use a simple inputbox. All explained in the
    help. No need for a form.
    To get the search code record with the macro recorder doing a search at
    workbooklevel.
    To get the code to add a new worksheet record this in a macro as well.
    To get the code to copy the rows record in a macro as well.
    Put it all together and you are on your way.
    Any particular problems report back.

    RBS

    "Rumish8086" <[email protected]> wrote in message
    news:[email protected]...
    > My task is to make a form which does the following: It needs to search an
    > Excel worksheet for a string of text entered by the user and then spit out
    > a
    > new worksheet with only rows containing that data.
    >
    > Seems like it should be very easy, but I am completely new to Excel and
    > all
    > of my attempts thus far have failed. I'm trying to learn some basic VBA as
    > quick as I can, but some help would be absolutely wonderful.
    >
    > Basically, the way it should look is this: there should be a box which
    > asks
    > for text, let's call this SearchString. And then there should be a button
    > beneath it that begins the search process (let's call this SearchStart).
    > After pressing the SearchStart button, the user should see all rows
    > containing the previously-entered SearchString in a new worksheet.
    >
    > Easy as that, but I don't know where to begin. Can someone help?
    >
    > Thanks!



  3. #3
    Rumish8086
    Guest

    Re: Database Search Form Help?

    Basically what I need to know (keep in mind that I have NO EXPERIENCE in VBA)
    is what the name of the variable that is typed into the inputbox I have made
    is?

    For example: I have a box called SearchCriteria into which the User can type
    the string of text he/she would like to search for. Then, under the
    SearchCriteria box, there is a button called SearchButton which the User can
    click in order to AutoFilter the data, leaving only rows that contain the
    search string typed into SearchCriteria.

    Here is the code I have right now:

    Private Sub SearchButton_Click()
    Worksheets("Sheet1").Range("A1").AutoFilter _
    field:=1, _
    Criteria1:=SearchCriteria.Text
    End Sub

    But for some reason this does not work. It seems as if the text that has
    been typed into SearchCriteria should be called "SearchCriteria.Text," but
    that does not work at all. What should I replace this variable with?

    I guess that's my most basic question.

    Thanks.

    "RB Smissaert" wrote:

    > What is the problem you are having?
    > To get the string to search for use a simple inputbox. All explained in the
    > help. No need for a form.
    > To get the search code record with the macro recorder doing a search at
    > workbooklevel.
    > To get the code to add a new worksheet record this in a macro as well.
    > To get the code to copy the rows record in a macro as well.
    > Put it all together and you are on your way.
    > Any particular problems report back.
    >
    > RBS
    >
    > "Rumish8086" <[email protected]> wrote in message
    > news:[email protected]...
    > > My task is to make a form which does the following: It needs to search an
    > > Excel worksheet for a string of text entered by the user and then spit out
    > > a
    > > new worksheet with only rows containing that data.
    > >
    > > Seems like it should be very easy, but I am completely new to Excel and
    > > all
    > > of my attempts thus far have failed. I'm trying to learn some basic VBA as
    > > quick as I can, but some help would be absolutely wonderful.
    > >
    > > Basically, the way it should look is this: there should be a box which
    > > asks
    > > for text, let's call this SearchString. And then there should be a button
    > > beneath it that begins the search process (let's call this SearchStart).
    > > After pressing the SearchStart button, the user should see all rows
    > > containing the previously-entered SearchString in a new worksheet.
    > >
    > > Easy as that, but I don't know where to begin. Can someone help?
    > >
    > > Thanks!

    >
    >


  4. #4
    RB Smissaert
    Guest

    Re: Database Search Form Help?

    I would start with an inputbox like this:

    Sub CopyRowsWithString()

    Dim strSearchString As String

    strSearchString = InputBox("Put in a string to search for." & _
    vbCrLf & vbCrLf & _
    "Rows holding this string will be copied to a
    new sheet.", _
    "copying rows with string")

    End Sub

    Next record Edit, Find, Within workbook, some string etc.
    and take it from there.

    RBS


    "Rumish8086" <[email protected]> wrote in message
    news:[email protected]...
    > Basically what I need to know (keep in mind that I have NO EXPERIENCE in
    > VBA)
    > is what the name of the variable that is typed into the inputbox I have
    > made
    > is?
    >
    > For example: I have a box called SearchCriteria into which the User can
    > type
    > the string of text he/she would like to search for. Then, under the
    > SearchCriteria box, there is a button called SearchButton which the User
    > can
    > click in order to AutoFilter the data, leaving only rows that contain the
    > search string typed into SearchCriteria.
    >
    > Here is the code I have right now:
    >
    > Private Sub SearchButton_Click()
    > Worksheets("Sheet1").Range("A1").AutoFilter _
    > field:=1, _
    > Criteria1:=SearchCriteria.Text
    > End Sub
    >
    > But for some reason this does not work. It seems as if the text that has
    > been typed into SearchCriteria should be called "SearchCriteria.Text," but
    > that does not work at all. What should I replace this variable with?
    >
    > I guess that's my most basic question.
    >
    > Thanks.
    >
    > "RB Smissaert" wrote:
    >
    >> What is the problem you are having?
    >> To get the string to search for use a simple inputbox. All explained in
    >> the
    >> help. No need for a form.
    >> To get the search code record with the macro recorder doing a search at
    >> workbooklevel.
    >> To get the code to add a new worksheet record this in a macro as well.
    >> To get the code to copy the rows record in a macro as well.
    >> Put it all together and you are on your way.
    >> Any particular problems report back.
    >>
    >> RBS
    >>
    >> "Rumish8086" <[email protected]> wrote in message
    >> news:[email protected]...
    >> > My task is to make a form which does the following: It needs to search
    >> > an
    >> > Excel worksheet for a string of text entered by the user and then spit
    >> > out
    >> > a
    >> > new worksheet with only rows containing that data.
    >> >
    >> > Seems like it should be very easy, but I am completely new to Excel and
    >> > all
    >> > of my attempts thus far have failed. I'm trying to learn some basic VBA
    >> > as
    >> > quick as I can, but some help would be absolutely wonderful.
    >> >
    >> > Basically, the way it should look is this: there should be a box which
    >> > asks
    >> > for text, let's call this SearchString. And then there should be a
    >> > button
    >> > beneath it that begins the search process (let's call this
    >> > SearchStart).
    >> > After pressing the SearchStart button, the user should see all rows
    >> > containing the previously-entered SearchString in a new worksheet.
    >> >
    >> > Easy as that, but I don't know where to begin. Can someone help?
    >> >
    >> > Thanks!

    >>
    >>



+ 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