I just can not get this code to work.
I want it to look for data equal to a user inputted Account Number and Start and End Date. The input bit seems to work, the rest doesn't.
Please Login or Register to view this content.
I just can not get this code to work.
I want it to look for data equal to a user inputted Account Number and Start and End Date. The input bit seems to work, the rest doesn't.
Please Login or Register to view this content.
Last edited by MAButler; 04-04-2011 at 02:41 PM.
One problem I see is your assignment of values to X1,Y1,Z1. Avanced Filter requires that the header of the criteria match the source headers... I don't think you do. For example youi've defined Your account column as "AccountColumn As Integer = 1 " but when you place your head in X1 you're getting your value of column number from a variable called "Account" ... what value does that have ?
MY ADVICE to you is to first make sure you are setting up your Advanced Critera Correctly ... in other words halt your code at the line ' Apply Advanced Filter and look at your sheet... is the criteria area set up with the correct information ?
How to halt code.... before running macro goto VBEditor and click on the code modules border on the line you want code to stop ...if done correctly a dot should appear on the module border and code line should change in color.
Please Login or Register to view this content.
Please Login or Register to view this content.
Last edited by nimrod; 04-03-2011 at 07:14 PM.
I have made the following changes, still no data.....
I have stopped at the point just before the delete line, and then using the sheet as it is I have manualy done the Advanced Filter and the data is sorted........
I have recorded a Macro and compaired it looks the same...... what is the problem....
Please Login or Register to view this content.
Hi
You need to amend your code as follows.
You are not using the correct criteria to pick up the filter headings, and you have not given any headings for the columns you want to extract
Please Login or Register to view this content.
--
Regards
Roger Govier
Microsoft Excel MVP
Keep it simple:
Please Login or Register to view this content.
Your post does not comply with Rule 8 of our Forum RULES. Cross-posting is when you post the same question in other forums on the web. You'll find people are disinclined to respond to cross-posts because they may be wasting their time solving a problem that has been solved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser)to the cross-post. Expect cross-posts without a link to be closed a message will be posted by the moderator explaining why. We are here to help so help us help you!
Read this to understand why we ask you to do this
Remember what the dormouse said
Feed your head
Last edited by romperstomper; 04-04-2011 at 08:00 AM.
Try:
Please Login or Register to view this content.
Hi MAButler:
Upload a sample so we can take a look at it.
Hi MAButler
Change these two lines of codeIt worked for me.Please Login or Register to view this content.
John
If you have issues with Code I've provided, I appreciate your feedback.
In the event Code provided resolves your issue, please mark your Thread as SOLVED.
If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.
Thanks for all the replies.......
I have tried them all:-
SNB = Took data over but only matching Account and Start date....... No match for the End Date and no new workbook.
romperstomper = Error code 'TYPE MISMATCH'
Nimrod = I have attached the file.....
Hi MAButler
Try the attached...notice, I HAVE changed some of your code
Thanks "jaslake", that worked........
Simple when you know how.......
Mike
Hi Mike...look at your dates...select a cell. See what the cell contains? Look at the Formula Bar...see what it contains?
Hi Mike
Select cell B12...in the cell, it says 07/04/2010
In the Formula Bar, it says 4/7/2010 (at least on my system). That's why the code worked.
Yes, I overlooked the fact your 'date' variables are actually strings, so you'd need:
Please Login or Register to view this content.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks