![]() |
|
|
||||||||
| Site Links |
| Consulting |
| Knowledge Base |
| Training |
| Forum |
| Articles |
| Resources |
| Products |
| Cool Tools |
| Contact |
| About Us |
| Go to Page... |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
|
userform search
Hi all,
I am new to excel user-form and last couple of days I came up with a user form which consists with "Date, Name, Project, Item, Percentage, Comment". All entries are saved in a sheet call "Data Base". I want to make a query using combo boxes. I made an another user-form and add combo boxes for "Date, Name, Project,Item,Percentage" and a command button. Now what I want to do is, if I select one or more values form combo boxes and hit command button, filter relevant Data entries from "Data Base " and Show in a new work sheet. please help me to do this. thanks in advanced |
|
Local Time: 05:47 PM
Local Date: 05-22-2013 Location:
|
|
|
|
#2 |
|
|
hi.
wellcome to VBAX. you can download sample file here to see how to populate a combobox with unique values from range (uses a named range). http://www.vbaexpress.com/kb/getarticle.php?kb_id=824 you may play with below code: VBA:
VBA tags courtesy of www.thecodenet.com
"... Make my enemy brave and strong, so that if defeated, I will not be ashamed..." Big Lodge Pole, Blackfeet "A patriot must always be ready to defend his country against his government." Edward Paul Abbey "When dictatorship is a fact, revolution becomes a right." Victor Hugo "Wrong life cannot be lived rightly." Theodor W. Adorno |
|
Local Time: 10:47 AM
Local Date: 05-22-2013 |
|
|
|
#3 |
|
|
please help with this
Hi, I tried with this code and I came-up with a problem. I only selected a value for combobox2 and then hit command button. Even though there is number of similar records in data base, "no data to copy" message appears.
What could be the reason for that |
|
Local Time: 05:47 PM
Local Date: 05-22-2013 Location:
|
|
|
|
#4 |
|
|
hi.
that's related with date and percent conversion. here's a workaround and a sample file. uses five named ranges for 5 criteria: Date : Date Name : String Project: String Item: String Percentage: Number (formatted as 0%. so change number format of crit in the code to suit your actual data) goes to std module: VBA:
VBA tags courtesy of www.thecodenet.com
goes to userform's code module VBA:
VBA tags courtesy of www.thecodenet.com
"... Make my enemy brave and strong, so that if defeated, I will not be ashamed..." Big Lodge Pole, Blackfeet "A patriot must always be ready to defend his country against his government." Edward Paul Abbey "When dictatorship is a fact, revolution becomes a right." Victor Hugo "Wrong life cannot be lived rightly." Theodor W. Adorno |
|
Local Time: 10:47 AM
Local Date: 05-22-2013 |
|
|
|
#5 |
|
|
Hi mancubus
Thanks for the reply and now I am getting an error. it says
"Run time error '1004: Method 'Range' of object'_Global' failed " What could be the reason for that? Sorry for bothering you. I am extremely new to the VB coding and I am still learning. I Paste my codes for your information.. It will be easy for you to find the error. Thanks again and appreciate your help. ===============my userform2 code as fallows==================== VBA:
VBA tags courtesy of www.thecodenet.com
============my module code as follows========================= VBA:
VBA tags courtesy of www.thecodenet.com
Last edited by xld : 04-03-2012 at 01:04 AM. Reason: Added VBA tags |
|
Local Time: 05:47 PM
Local Date: 05-22-2013 Location:
|
|
|
|
#6 |
|
|
i was not able to duplicate your problem.
can you post your workbook. (minimum post count must be at leat 5, i think, to upload a file.) ps: post your code within vba tags please. pps: did you test the file i posted? "... Make my enemy brave and strong, so that if defeated, I will not be ashamed..." Big Lodge Pole, Blackfeet "A patriot must always be ready to defend his country against his government." Edward Paul Abbey "When dictatorship is a fact, revolution becomes a right." Victor Hugo "Wrong life cannot be lived rightly." Theodor W. Adorno |
|
Local Time: 10:47 AM
Local Date: 05-22-2013 |
|
|
|
#7 |
|
|
I ll upload the file
|
|
Local Time: 05:47 PM
Local Date: 05-22-2013 Location:
|
|
|
|
#8 |
|
|
1
|
|
Local Time: 05:47 PM
Local Date: 05-22-2013 Location:
|
|
|
|
#9 |
|
|
This is my workbook
Actually I wanted to create form for Add Data (Data should be saved in another workbook. ) and a Query form.
Zip file is more than 1mb , so I uploaded my file to rapidshare and here is the link (https://rapidshare.com/files/3477359884/Book1.zip). https://rapidshare.com/files/3477359884/Book1.zip Thanks |
|
Local Time: 05:47 PM
Local Date: 05-22-2013 Location:
|
|
|
|
#10 |
|
|
ok. but we dont have access to rapid in the office.
you may unpload the file with 20-30 rows of data to help understand the data types in the columns. "... Make my enemy brave and strong, so that if defeated, I will not be ashamed..." Big Lodge Pole, Blackfeet "A patriot must always be ready to defend his country against his government." Edward Paul Abbey "When dictatorship is a fact, revolution becomes a right." Victor Hugo "Wrong life cannot be lived rightly." Theodor W. Adorno |
|
Local Time: 10:47 AM
Local Date: 05-22-2013 |
|
|
|
#11 |
|
|
I think this is what you want. I tried to send you my workbook. But I couldn't reduce the file size. If you can send me your email (trough private message), then I can send you my workbook. It may be very helpful to you to figure out the problem easily.
Thanks VBA:
VBA tags courtesy of www.thecodenet.com
|
|
Local Time: 05:47 PM
Local Date: 05-22-2013 Location:
|
|
|
|
#12 |
|
|
ok. im home and downloaded your file.
your file is too large because you created excel tables from entire columns. file is attached. UF5 is my thing. tested and its working. ps: same file. i only converted tables to ranges. see the diffrence in sizes. ![]() "... Make my enemy brave and strong, so that if defeated, I will not be ashamed..." Big Lodge Pole, Blackfeet "A patriot must always be ready to defend his country against his government." Edward Paul Abbey "When dictatorship is a fact, revolution becomes a right." Victor Hugo "Wrong life cannot be lived rightly." Theodor W. Adorno |
|
Local Time: 10:47 AM
Local Date: 05-22-2013 |
|
|
|
#13 |
|
|
Hi,
Again I got following problem. Sorry for bothering you... Userform5- when I try to filter data with Date , it says "no data to copy" even though there are some records in the database . I have one more thing to clarify: I want to keep data entry form,filter form separate workbook (let say workbook1) and the all the other things (Data base sheet and Item sheet) in another workbook (let say workbook2). As I learnt last couple of days, Set rngSource = Worksheets("item").Range("c2:c1048576") should be changed to Set rngSource = Workbooks("workbook2").Worksheets("item").Range("c2:c1048576"). But the problem is, I have to open both file to work with forms. I don't want to open workbook2. As I understand there are no way other than opening workbook2. I think the best way to do it, when the forms open, workbook should open automatically, but workbook should not appears to the user(need to hide from the user). What do you think? Problem is I don't know the code for that. I tried to find. but I couldn't. Could you please tell me the solution for that. VBA:
VBA tags courtesy of www.thecodenet.com
|
|
Local Time: 05:47 PM
Local Date: 05-22-2013 Location:
|
|
|
|
#14 |
|
|
I Updated...
Thanks to sharing........ |
|
Local Time: 11:47 PM
Local Date: 05-21-2013 Location:
|
|
|
|
#15 |
|
|
For the issue where you get the pop up "no data to copy"
You might try this trick I got from Xld to deal with different regional settings. Change this line: VBA:
VBA tags courtesy of www.thecodenet.com
To this: VBA:
VBA tags courtesy of www.thecodenet.com
|
|
Local Time: 11:47 PM
Local Date: 05-21-2013 Location:
|
|
|
|
#16 |
|
|
Hi Frank,
I changed the code as you said. but it doesnt work for me |
|
Local Time: 05:47 PM
Local Date: 05-22-2013 Location:
|
|
|
|
#17 |
|
|
see attached files. one is for data base, the other is for data entry and filtering
tested and it works. after entering data or filtering DataBaseFile is closed. reopen to see the results. "... Make my enemy brave and strong, so that if defeated, I will not be ashamed..." Big Lodge Pole, Blackfeet "A patriot must always be ready to defend his country against his government." Edward Paul Abbey "When dictatorship is a fact, revolution becomes a right." Victor Hugo "Wrong life cannot be lived rightly." Theodor W. Adorno |
|
Local Time: 10:47 AM
Local Date: 05-22-2013 |
|
|
|
#18 |
|
|
dbfile
"... Make my enemy brave and strong, so that if defeated, I will not be ashamed..." Big Lodge Pole, Blackfeet "A patriot must always be ready to defend his country against his government." Edward Paul Abbey "When dictatorship is a fact, revolution becomes a right." Victor Hugo "Wrong life cannot be lived rightly." Theodor W. Adorno |
|
Local Time: 10:47 AM
Local Date: 05-22-2013 |
|
|
|
#19 | |||||||||||||||||||||||
|
|
Hi mancubus, Thank you very much for the project. It works brilliantly (except the "date" filter , when I try to search using a date..it always says "no data to copy" ). Could you please check it again for me. Thank you very much again. |
|||||||||||||||||||||||
|
Local Time: 05:47 PM
Local Date: 05-22-2013 Location:
|
|
|
|
#20 |
|
|
you're wellcome hussy.
you should play with date filter... VBA:
VBA tags courtesy of www.thecodenet.com
another approach could be... VBA:
VBA tags courtesy of www.thecodenet.com
"... Make my enemy brave and strong, so that if defeated, I will not be ashamed..." Big Lodge Pole, Blackfeet "A patriot must always be ready to defend his country against his government." Edward Paul Abbey "When dictatorship is a fact, revolution becomes a right." Victor Hugo "Wrong life cannot be lived rightly." Theodor W. Adorno |
|
Local Time: 10:47 AM
Local Date: 05-22-2013 |
|
![]() |
| Display Modes |
Linear Mode |
Switch to Hybrid Mode |
Switch to Threaded Mode |
|
|


