Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Search number within a database | Excel Worksheet Functions | |||
Database Search For Help? | Excel Discussion (Misc queries) | |||
Creating A Search Database..Need Help | Excel Discussion (Misc queries) | |||
How to search a value with two criteria from a database? | Excel Programming | |||
Qn: Best way to search a database to match a last name?? | Excel Programming |