+ Reply to Thread
Results 1 to 14 of 14

Search Separate Workbook - Error

  1. #1
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Search Separate Workbook - Error

    Please refer to the attached files.

    The search function works eventually after several iterations through. The issue centers on setting the separate workbook to be opened from the main program and then being able to click on
    the returned data in the Listbox for it to be displayed above .... I'm just not getting it corrected as needed.

    What edits are required to get it working correctly ?

    Thank you.
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    08-09-2012
    Location
    British Columbia
    MS-Off Ver
    Excel 2010
    Posts
    189

    Re: Search Separate Workbook - Error

    Can you explain and/or describe what this means, and what we are supposed to see or not see happening?
    The search function works eventually after several iterations through.

  3. #3
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Search Separate Workbook - Error

    On my machine, when a search term is entered in "Search Prefix" the query function is initiated. Rather than find the appropriate data and display in the ListBox in one motion, the project goes through several 'steps' or 'motions' to complete the query .... eventually displaying the data term in the ListBox. Another project utilizes this same method (syntax) of querying data within the same workbook (not another separate workbook) and completes the query function in a 'single step'. There is no hesitation - no obvious indication of going through several iterations of the query and then displaying the found data.

    The separate workbook holding the database (FCC.xlsx) is opened when 'US Call Sign Search' is initiated (see: ThisWorkBook). The separate workbook is also referred to in the 'f_FindAll' form code.
    I'm certain how those are coded and/or where that syntax resides in the project ( 'US Call Sign Search') is the crux of the matter. I'm not certain how to correct it.

    I hope I've explained it more clearly ? The written word is sometimes harder to convey meaning or thoughts.

    Thanks NoSparks !

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Search Separate Workbook - Error

    How can we replicate the problem(s) with the attached workbooks?
    If posting code please use code tags, see here.

  5. #5
    Forum Contributor
    Join Date
    08-09-2012
    Location
    British Columbia
    MS-Off Ver
    Excel 2010
    Posts
    189

    Re: Search Separate Workbook - Error

    Playing around with this the way I did the biggest issue was whether or not the FCC workbook was open.

    With the FCC file you attached (2000 rows) things appear pretty much instantaneous.
    No doubt your 'real' FCC workbook is the one with a million rows which takes an eternity to open.
    I suspect the FindAll function would take substantially longer as well.

    I'm looking forward to see the response to Norie.

  6. #6
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Search Separate Workbook - Error

    Norrie and NoSparks

    Sent you a private message.

  7. #7
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Search Separate Workbook - Error

    I've gotten it to load the query find in a reasonable time but am now getting a "Select Method of Range Class Failed" error with the highlight shown below in red:

    Please Login or Register  to view this content.
    Any syntax changes that may have occurred from the first posted code - to this snippet - are in this snippet.

    HTH

  8. #8
    Forum Contributor
    Join Date
    08-09-2012
    Location
    British Columbia
    MS-Off Ver
    Excel 2010
    Posts
    189

    Re: Search Separate Workbook - Error

    You can't make a selection on a sheet that isn't active.

    Try the attached.
    It's named slightly different and you'll need to adjust path to files.
    Attached Files Attached Files

  9. #9
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Search Separate Workbook - Error

    Do you need this line?
    Please Login or Register  to view this content.
    PS You can exit a For loop using Exit For.

  10. #10
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Search Separate Workbook - Error

    NoSparks & Norie

    Thank you for the assist. Your changes work very well.

    Norie: I removed that one line and you are correct ... it's not needed. I'll have to see if removing it from the other project has the same effect.

    NoSparks:
    You can't make a selection on a sheet that isn't active.
    Are you referring to the sheet or the workbook ? The added line 'wb.Activate' ... does that apply to the sheet or the workbook ? I presumed the "wb." meant workbook ? I'm learning ... help me understand ?

  11. #11
    Forum Contributor
    Join Date
    08-09-2012
    Location
    British Columbia
    MS-Off Ver
    Excel 2010
    Posts
    189

    Re: Search Separate Workbook - Error

    The added line 'wb.Activate' ... does that apply to the sheet or the workbook ? I presumed the "wb." meant workbook ?
    Yes it does mean workbook. That's what it's declared as and set to earlier in the sub.
    Guess it's just lucky that the workbook is always on the right sheet.

  12. #12
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Search Separate Workbook - Error

    What if you wanted to specify another worksheet, other than #1. What would the syntax look like then ?

  13. #13
    Forum Contributor
    Join Date
    08-09-2012
    Location
    British Columbia
    MS-Off Ver
    Excel 2010
    Posts
    189

    Re: Search Separate Workbook - Error

    Specify the sheet
    Please Login or Register  to view this content.
    Do I sense the FCC workbook having 26 sheets ?

  14. #14
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Search Separate Workbook - Error

    No. I managed to cull it down to a single sheet, approx. 800,000 rows. However, discovered something else I didn't realize. In order to remove the Expired/Inactive/Terminated listings, there are actually
    two identifiers that have to be referenced in the 'master list'. ("Master List = those id's that need to be removed). Now, I'm scratching my head how to modify the previous code that culls out those id's so it will
    reference first the call, then a serial number that is assigned to the call. There are some calls that have several locations in the list. One may be terminated ... a second rendition may be expired and the third will be the present owner who is active. Each one has a different/unique serial number assigned to it.

    The code that accomplished the task only refers to the call.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 08-06-2015, 10:33 AM
  2. Replies: 3
    Last Post: 07-01-2014, 02:48 PM
  3. Data will be copied from a separate workbook to worksheet RawData in another workbook
    By pghpens44 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-13-2014, 10:07 AM
  4. Replies: 4
    Last Post: 02-25-2013, 04:10 PM
  5. [SOLVED] continuation of How to search part of data from separate workbook
    By jdenglere in forum Excel Formulas & Functions
    Replies: 17
    Last Post: 10-27-2012, 07:14 AM
  6. Macro to auto-email separate worksheets of same workbook to separate recipients?
    By Sean Anderson in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-09-2007, 09:51 PM
  7. Select sheet tabs in workbook & save to separate workbook files
    By stratocaster in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-01-2006, 11:40 AM

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