+ Reply to Thread
Results 1 to 13 of 13

Find Products code - what's wrong with it

  1. #1
    Forum Contributor
    Join Date
    06-16-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007; Excel 2010
    Posts
    178

    Find Products code - what's wrong with it

    Hi All,

    Below I have the code to find products within a date range.
    Not exactly fast or the best. Anybody show me how to improve the efficiency of the code.

    Much appreciated...


    Please Login or Register  to view this content.
    Thanks

    Lionel
    Last edited by Foreverlearning; 03-05-2012 at 09:47 PM.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,486

    Re: Find Products code - what's wrong with it

    To best describe or illustrate your problem you would be better off attaching a dummy workbook, the workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook. Don't upload a picture when you have a workbook question. None of us is inclined to recreate your data. Upload the workbook and manually add an 'after' situation so that we can see what you expect. In addition clearly explain how you get the results..
    To attach a file to your post, you need to be using the main 'New Post' or 'New Thread' page and not 'Quick Reply'.
    To use the main 'New Post' page, click the 'Post Reply' button in the relevant thread.

    On this page, below the message box, you will find a button labelled 'Manage Attachments'.
    Clicking this button will open a new window for uploading attachments.

    You can upload an attachment either from your computer or from another URL by using the appropriate box on this page.
    Alternatively you can click the Attachment Icon to open this page.

    To upload a file from your computer, click the 'Browse' button and locate the file.

    To upload a file from another URL, enter the full URL for the file in the second box on this page.
    Once you have completed one of the boxes, click 'Upload'.

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Find Products code - what's wrong with it

    Hi,

    Can you also upload the workbook. It's always easier to comment if we can see the request in context

    It may also be the case that you don't need a macro at all, and even if you do a looping macro may not be necessary

    Would you therefore describe what you are aiming for as an end result and manually add some results to the worksheet indicating which cells are results and which are original data.

    Regards
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Forum Contributor
    Join Date
    06-16-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007; Excel 2010
    Posts
    178

    Re: Find Products code - what's wrong with it

    Hi Guys,

    I have reduced my workbook to reflect what I want to explain.

    I have attached the workbook and another main issue is I have to repeat code several times for same task.

    Can somebody show me a better way to do this.

    Thanks
    Lionel
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    06-16-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007; Excel 2010
    Posts
    178

    Re: Find Products code - what's wrong with it

    Can anybody check this for me please.

    Much appreciated

    Lionel

  6. #6
    Forum Contributor
    Join Date
    06-16-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007; Excel 2010
    Posts
    178

    Re: Find Products code - what's wrong with it

    Even an example would be very helpful

  7. #7
    Forum Contributor
    Join Date
    06-16-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007; Excel 2010
    Posts
    178

    Re: Find Products code - what's wrong with it

    Ok must be week-end nobody has a simple comment. I just have to wait and persist.

  8. #8
    Forum Contributor
    Join Date
    06-16-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007; Excel 2010
    Posts
    178

    Re: Find Products code - what's wrong with it

    Anybody today with an option

  9. #9
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Find Products code - what's wrong with it

    Hi foreverlearning
    In the attached I've only addressed this issue
    I have to repeat code several times for same task.
    Try it...if you like it and have other issues to explore, let me know.
    Attached Files Attached Files
    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.

  10. #10
    Forum Contributor
    Join Date
    06-16-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007; Excel 2010
    Posts
    178

    Question Re: Find Products code - what's wrong with it

    Hi jaslake,

    Thank you very much for taking the time to look at my code.

    I am examining how you approached this issue and trying to get my head around it.

    Could you explain to me even in my code as well as yours when obLB declared as an Object and when
    it goes thru the code cycle it shows as null (obLB = null), yet it works perfectly OK.

    I can't get my head around this.

    I have another seemingly complex issue (to me anyway) which I better post in a new thread.

    Thanks
    Lionel

  11. #11
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Find Products code - what's wrong with it

    Hi Lionel
    obLB evaluates to "Null" because there is no item selected in the ListBox.

  12. #12
    Forum Contributor
    Join Date
    06-16-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007; Excel 2010
    Posts
    178

    Re: Find Products code - what's wrong with it

    Thanks mate

    Glad you helped.

    Lionel

  13. #13
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Find Products code - what's wrong with it

    If this was useful then please rate it appropriately.

+ 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