+ Reply to Thread
Results 1 to 7 of 7

method 'Range' of object"_global' failed

  1. #1
    Registered User
    Join Date
    04-24-2012
    Location
    Woodstock CT USA
    MS-Off Ver
    Excel 2010
    Posts
    9

    method 'Range' of object"_global' failed

    I am writing a macro using the "inputbox" reference. I have preselected a range (within the macro), and now want to allow any user to sort on any column by selecting the column (in the worksheet entitled "Orientation") using a mouse click. The code below is the summary of my effort (Although I did not include the "sort" branch here for brevity)... everything works as expected until the variable call identifying the column; at this point, I get the error message in my post title.

    Thanks in advance for your review.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: method 'Range' of object"_global' failed

    Stevegia,

    You're treating your range object variable rRange as text instead of a range object. Just use it directly instead of trying to refer to it:
    Please Login or Register  to view this content.
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: method 'Range' of object"_global' failed

    Is everything happening on the same worksheet ("Orientation")?
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Registered User
    Join Date
    04-24-2012
    Location
    Woodstock CT USA
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: method 'Range' of object"_global' failed

    Thank you so much.... I had tried several changes in this line of code before submitting the problem... your solution was easy to understand and quick to implement.

  5. #5
    Registered User
    Join Date
    08-17-2012
    Location
    Belgium
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: method 'Range' of object"_global' failed

    Hi all,

    I seem to get the same Error with the method 'Range'. (this place might be the wrong place to ask this as I use VBA in Outlook)

    Tryed to figure out this issue with the solution of TigerAvatar, but seems like it isn't the same story here..

    I got a Workbook with 3 worksheets.
    on the Second worksheet is a list of persons on colum A and a date behind them on B and so on..
    Excelworksheet2.jpg

    Recorded a macro to see what happens exactly when right click on "Naam" then "Sort" then "Sort A to Z"
    This give me

    Please Login or Register  to view this content.
    With this info i go to my VBA in Outlook and I get the method 'Range' of object"_global" as i run my code..

    Is there a way to change the range("Table1[[#Header],[Naam]]")?
    Because I think he sees it as Text instead of object, that he need to use to sort the Worksheet?

    This is the code i use in Outlook to point him to Excel
    Please Login or Register  to view this content.
    Sorry if this isn't the right place to ask or if this isn't a Excel related issue..

    Great thanks in advanced..

  6. #6
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    Win10/MSO2016
    Posts
    12,996

    Re: method 'Range' of object"_global' failed

    @Silverboyke:
    Welcome to the Forum, unfortunately:

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.
    Ben Van Johnson

  7. #7
    Registered User
    Join Date
    08-17-2012
    Location
    Belgium
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: method 'Range' of object"_global' failed

    Sorry about that.. will create new post.. thank you for pointing this out..

+ 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