+ Reply to Thread
Results 1 to 5 of 5

Code to select range and open a user form is opening the wrong range

  1. #1
    Registered User
    Join Date
    07-30-2010
    Location
    Oregon
    MS-Off Ver
    Excel 2007
    Posts
    44

    Code to select range and open a user form is opening the wrong range

    I don't see how this can be possible... so I must ask here. My code is

    Please Login or Register  to view this content.

    Yet it doesn't open the form for this table... it opens the form for another RANGE that is higher on the sheet. I don't understand how this could be. When I record the macro for this, it always opens the correct form, and then when I run it always opens the wrong one.
    Last edited by rrbest; 11-06-2010 at 02:55 PM.

  2. #2
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,523

    Re: Code to select range and open a user form is opening the wrong range

    Hard to say for sure without having a sample of the workbook at hand but at a guess I'd say that all errors have been turned off as you can't have a range name called "Table1[#All]" so the named range isn't being changed from its previous setting.
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

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

    Re: Code to select range and open a user form is opening the wrong range

    Your code should not run at all as it is syntactically wrong - it should be:
    Please Login or Register  to view this content.
    However, there are issues with this method - see MSKB article here. Your data needs to start in A1:B2 or be named Database. This should work:
    Please Login or Register  to view this content.
    assuming you don't have an existing range named Database.
    Remember what the dormouse said
    Feed your head

  4. #4
    Registered User
    Join Date
    07-30-2010
    Location
    Oregon
    MS-Off Ver
    Excel 2007
    Posts
    44

    Re: Code to select range and open a user form is opening the wrong range

    Quote Originally Posted by romperstomper View Post
    Your code should not run at all as it is syntactically wrong - it should be:
    Please Login or Register  to view this content.
    However, there are issues with this method - see MSKB article here. Your data needs to start in A1:B2 or be named Database. This should work:
    Please Login or Register  to view this content.
    assuming you don't have an existing range named Database.

    Thank you. This solved the issue.

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

    Re: Code to select range and open a user form is opening the wrong range

    Glad to help. Please don't forget to mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ 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