+ Reply to Thread
Results 1 to 15 of 15

Dynamic Range Rantime error

  1. #1
    Registered User
    Join Date
    03-22-2010
    Location
    Ballarat, Australia
    MS-Off Ver
    Excel 2003
    Posts
    31

    Dynamic Range Rantime error

    In the attached spreadheet, I have a dynamic range defined which populates a dropdown

    https://dl.dropboxusercontent.com/u/...Dashboard.xlsm

    Dynamic Range Is

    =OFFSET(Projects!$C$1,1,0,COUNTIF(Projects!$C:$C,">""")-1,2)

    This populates a drop down in the Dashboard TAB under label Project ID & Name. In the code linked to this dropdown I have the following


    Please Login or Register  to view this content.
    This all works fine when I have only this one workbook opened, but as soon as I have a second spreadsheet open I start getting runtime errors related to the dynamiclist range, e.g below

    Runtime_error.png

  2. #2
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Dynamic Range Rantime error

    Your Dropbox link doesn't seem to work. Perhaps you can clear the listfillrange and use the List instead:
    Please Login or Register  to view this content.
    although I'm not sure why you want to change the list after selecting a value from it?
    Remember what the dormouse said
    Feed your head

  3. #3
    Registered User
    Join Date
    03-22-2010
    Location
    Ballarat, Australia
    MS-Off Ver
    Excel 2003
    Posts
    31

    Re: Dynamic Range Rantime error

    https://dl.dropboxusercontent.com/u/...Dashboard.xlsm

    Reposting link

    Code to fill dropdown has been working nicely, just this problem when I have more than one spreadsheet opened

  4. #4
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Dynamic Range Rantime error

    Try using:
    Please Login or Register  to view this content.
    I still don't see why you want to reset the list every time you select a value (it calls your code twice).

  5. #5
    Registered User
    Join Date
    03-22-2010
    Location
    Ballarat, Australia
    MS-Off Ver
    Excel 2003
    Posts
    31

    Re: Dynamic Range Rantime error

    Hi - OK I will try it, from memory it was something to do with if I added in a project to the Projects tab and hadn't saved the workbook, it wasn't pickking up the latest additions in the dropdown, but I'll try your code and see if it handles the scenario...

  6. #6
    Registered User
    Join Date
    03-22-2010
    Location
    Ballarat, Australia
    MS-Off Ver
    Excel 2003
    Posts
    31

    Re: Dynamic Range Rantime error

    OK, I changed the combobox code to the following

    Please Login or Register  to view this content.
    .. and it now gives me a compile error at .Range on the second line of code?

  7. #7
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Dynamic Range Rantime error

    That's because you've removed your With...End With block for some reason.

  8. #8
    Registered User
    Join Date
    03-22-2010
    Location
    Ballarat, Australia
    MS-Off Ver
    Excel 2003
    Posts
    31

    Re: Dynamic Range Rantime error

    OK, that was an accident. I will test out the worksheet with your suggested code and see whether I get the error re-occurring.. Thanks

  9. #9
    Registered User
    Join Date
    03-22-2010
    Location
    Ballarat, Australia
    MS-Off Ver
    Excel 2003
    Posts
    31

    Re: Dynamic Range Rantime error

    OK, your code for populating the dropdown is fine, but has not resolved the runtime error i was originally getting when multiple spreadsheets are open. When I click debug on the error it goes to this line of code

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    03-22-2010
    Location
    Ballarat, Australia
    MS-Off Ver
    Excel 2003
    Posts
    31

    Re: Dynamic Range Rantime error

    Can anyone work out why I am getting this runtime error then?
    Attached Images Attached Images

  11. #11
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Dynamic Range Rantime error

    I can't replicate the error. What version of Excel are you actually using? (your profile says 2003 but that's an XML format file)

  12. #12
    Registered User
    Join Date
    03-22-2010
    Location
    Ballarat, Australia
    MS-Off Ver
    Excel 2003
    Posts
    31

    Re: Dynamic Range Rantime error

    It is 2010.. It is odd, it seems to happen only when I have another workbook open that also has VBA code in it. if I open just a standard workbook then it doesn't happen

  13. #13
    Registered User
    Join Date
    03-22-2010
    Location
    Ballarat, Australia
    MS-Off Ver
    Excel 2003
    Posts
    31

    Re: Dynamic Range Rantime error

    still needing a resolution, basically i am getting the runtime error whenever I have the spreadsheet linked to in this posting opened along with any other spreadsheet that also is running vba code

  14. #14
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Dynamic Range Rantime error

    I can't replicate that either. Is it any workbook with code in it, or just a specific one?

  15. #15
    Registered User
    Join Date
    03-22-2010
    Location
    Ballarat, Australia
    MS-Off Ver
    Excel 2003
    Posts
    31

    Re: Dynamic Range Rantime error

    Ill post the other one in dropbox that causes the error to occur if opened at the same time

+ 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. Error when selecting dynamic range
    By BoRdo in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 10-03-2012, 09:04 AM
  2. [SOLVED] Name a dynamic range - Run-time error 1004 Method 'Range' of object'_Worksheet' failed
    By DavidBW in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-03-2012, 08:00 AM
  3. N/A Error on a dynamic named range
    By PelleCadol in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-14-2011, 08:19 AM
  4. Replies: 5
    Last Post: 07-27-2010, 10:58 AM
  5. [SOLVED] Trapping error with dynamic range
    By ArthurJ in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-28-2005, 04:05 PM

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