Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default 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" wrote in message
...
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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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" wrote in message
...
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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default 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" wrote in message
...
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" wrote in message
...
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Search number within a database Montu Excel Worksheet Functions 2 December 7th 07 02:08 PM
Database Search For Help? Rumish8086 Excel Discussion (Misc queries) 12 January 11th 06 09:00 PM
Creating A Search Database..Need Help ajaffer Excel Discussion (Misc queries) 6 December 3rd 05 09:50 PM
How to search a value with two criteria from a database? alex lee Excel Programming 2 June 24th 05 01:57 PM
Qn: Best way to search a database to match a last name?? Michael Vaughan Excel Programming 1 September 2nd 04 11:20 PM


All times are GMT +1. The time now is 03:40 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"