+ Reply to Thread
Results 1 to 9 of 9

Userform Listbox to Activesheet.Range(Activecell.address).Value Error

  1. #1
    Registered User
    Join Date
    10-14-2011
    Location
    chesapeake, va
    MS-Off Ver
    Excel 2007
    Posts
    59

    Userform Listbox to Activesheet.Range(Activecell.address).Value Error

    Hello Everyone,
    so I've Been Working on a project using a userform listbox to pull data from the web, then you select the data and it enters it into the activecell starting at cells(0, 0) in theory.
    Ok a little bit of Workbook insight to help with functionality:

    1 sheet1 - double click on cell range A3-A2000 will add title to Userform1.tbsearch (film title)

    2 click search button will populate lbsearch (search results) with list of movies

    3 click getData (Get Movie Data) will populate DataResults (results) with movie info

    4 (this is where its broken) doubleclick movieinfo (getData textbox) should populate active
    cell on sheet1 offsetting to each column of same row with data from DataResults ListBox..
    but errors out on list index..

    WorkBook: MoviesV4.xlsm

    this is the code:
    Please Login or Register  to view this content.
    i had it working when i separated the data into two userforms, but thought that to be inefficient but it did at least work.
    any help here will be absolutely appreciated
    Last edited by Spyderz; 10-26-2012 at 05:02 PM. Reason: Solved

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

    Re: Userform Listbox to Activesheet.Range(Activecell.address).Value Error

    Does the code actually error?

    When I try it there are no errors.

    There's nothing in the DataResults listbox, shouldn't you be taking values from the search results listbox?

  3. #3
    Registered User
    Join Date
    10-14-2011
    Location
    chesapeake, va
    MS-Off Ver
    Excel 2007
    Posts
    59

    Re: Userform Listbox to Activesheet.Range(Activecell.address).Value Error

    Thanks for the Reply Nori, good to see you again.
    The Search results just give the list of movies searched from the movie name, allowing you to choose the correct Movie you want to pull info from, when its double clicked, the tMDB ID is populated to the Selected tMDB text box, then you can click Get Movie Daata to verify in the Results text box at the bottom if the Data is accurate. double clicking the results info, or clicking the Accept button should populate the Worksheet at the active cell. i had it working as i said when i was using a seperate userform box, but when i merged it all together into the same userform, i get the following errors. I'm not sure if i changed the code, or if it just doesn't like coming from the same userform.
    heres the screen shots of the errors:
    Results Error.PNG
    Debuged.PNG

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    Why not populate the worksheet from the results listbox?
    If posting code please use code tags, see here.

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

    Re: Userform Listbox to Activesheet.Range(Activecell.address).Value Error

    To get the code to work all you need to do is change the For Next to this.
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    10-14-2011
    Location
    chesapeake, va
    MS-Off Ver
    Excel 2007
    Posts
    59

    Re: Userform Listbox to Activesheet.Range(Activecell.address).Value Error

    Thanks Again Norie,
    So I put in the new For Statement, and again it errors on me,
    Debug 2.png

    Please Login or Register  to view this content.
    It worked twice, then just continued to error out

    Its probably me I'm certain. as for using the second search string to populate the Movie info, the reason behind that is cause the search from movie title doesn't have enough Data, and the results are varied, where as the second search string id specific to the Movie ID number, bringing back only that movies results, and has all the infomation i could need.
    i just realised when i use my radio button to do a search, it errors at htis line
    Please Login or Register  to view this content.
    but it seems to be random.. thats i guess a different topic though..
    -Daniel
    Last edited by Spyderz; 10-25-2012 at 11:15 AM.

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

    Re: Userform Listbox to Activesheet.Range(Activecell.address).Value Error

    Daniel

    Can I ask why you have the second listbox which only seems to be repeating data from the results listbox?

    Why not just select from the results listbox?

  8. #8
    Registered User
    Join Date
    10-14-2011
    Location
    chesapeake, va
    MS-Off Ver
    Excel 2007
    Posts
    59

    Re: Userform Listbox to Activesheet.Range(Activecell.address).Value Error

    Norie

    The userform will be used when movie info is incorrect. The Module APIrun will gather the bulk of info. this worksheet is only to workout the bugs, and correct the code, the final worksheet has a control sheet for displaying the selected data, running the movie, keeping up with organizing, ETC

    API # is a Key

    The Search results List Box uses the Web Address of
    HTML Code: 
    and the "strMovie" Variant (Movie Title) has to be the text movie title i.e. Fight Club
    HTML Code: 
    it also returns a range of movie titles with the same text to select the corrected one from



    Where as the results List Box uses
    HTML Code: 
    and the "strMovie" Variant (Movie ID#) has to be the the Movie ID Number i.e. 550
    HTML Code: 
    and it only returns the movie info for specified ID #, plus it has info such as director, official site, trailer, poster, etc.. i just don't know how to pull the extra info yet
    Last edited by Spyderz; 10-25-2012 at 03:08 PM.

  9. #9
    Registered User
    Join Date
    10-14-2011
    Location
    chesapeake, va
    MS-Off Ver
    Excel 2007
    Posts
    59

    Re: Userform Listbox to Activesheet.Range(Activecell.address).Value Error

    So turns out all the code works fine:

    The error was due to the Data not being Selected. That and the For Next change Norie suggested:
    Please Login or Register  to view this content.
    So I added and Auto select Data where the List box is populated:
    Please Login or Register  to view this content.
    And this is the code for the add listbox data to Active cell row:
    Please Login or Register  to view this content.

+ 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