+ Reply to Thread
Results 1 to 4 of 4

Error '1004': Method 'Range' of object '_Global' failed

  1. #1
    Registered User
    Join Date
    06-28-2018
    Location
    Tempe, Arizona
    MS-Off Ver
    2010
    Posts
    10

    Error '1004': Method 'Range' of object '_Global' failed

    Good afternoon,

    I am trying to run a macro that selects the specified cells and clears the contents. It seems once I exceed a certain number of cells in my selection this error message pops up with the arrow pointing to the last line: )).Select

    Sub Test_Clear_Contents()
    '
    '
    'Clear Content from selected ranges

    Union(Range( _
    "BM28:BN57,BR25:BS25,BQ28:BR57,BV25:BW25,BU28:BV57,BZ25:CA25,BY28:BZ57,CD25:CE25,CC28:CD57,CH25:CI25,CG28:CH57,CL25:CM25,CK28:CL57,CP25:CQ25,CO28:CP57,CT25:CU25,CS28:CT57,CX25:CY25,CW28:CX57,DB25:DC25,DA28:DB57,DF25:DG25,DE28:DF57,DJ25:DK25,DI28:DJ57" _
    ), Range( _
    "DY28:DZ57,ED25:EE25,EC28:ED57,EH25:EI25,EG28:EH57,EL25:EM25,EK28:EL57,EP25:EQ25,EO28:EP57,F25:G25,E28:F57,J25:K25,I28:J57,N25:O25,M28:N57,R25:S25,Q28:R57,V25:W25,U28:V57,Z25:AA25,Y28:Z57,AD25:AE25,AC28:AD57,AH25:AI25,AG29:AH53,AG28:AH57,AL25:AM25,AK28:AL57" _
    ), Range( _
    "AX25:AY25,AW28:AX57,BB25:BC25,BA28:BB57,BF25:BG25,BE28:BF57,BJ25:BK25,BI28:BJ57,BN25:BO25" _
    )).Select
    Range("EP28").Activate
    Selection.ClearContents
    End Sub


    I am fairly new with VBA and will likely not understand what the issue is without it being explained in layman's terms. Everything I've seen and attempted trying from different resources have not solved the issue. Thank you in advance for your help!

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,900

    Re: Error '1004': Method 'Range' of object '_Global' failed

    Please Login or Register  to view this content.
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Registered User
    Join Date
    06-28-2018
    Location
    Tempe, Arizona
    MS-Off Ver
    2010
    Posts
    10

    Re: Error '1004': Method 'Range' of object '_Global' failed

    Thank you Hans! this worked great and is self-explanatory enough to understand why the original code didn't work. All the best.

  4. #4
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,900

    Re: Error '1004': Method 'Range' of object '_Global' failed

    You're welcome.
    Sorry for the direct answer and no explanation. Was in a hurry
    The main reason your solution did not work is because it exceeded th max number of ranges you can place in a union.
    I don't know what the limit is exactly but this was just trial and error.
    You also do need to select is just define is and carry out the action.

+ 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. Run-time error '1004: Method 'range' of object'_Global' failed
    By narendrabr in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 02-01-2014, 05:56 AM
  2. [SOLVED] Run-time error ‘1004’: Method ‘Range’ of ‘object’_Global’ failed.
    By dhiresh in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-08-2013, 12:04 PM
  3. Run-time error '1004'. Method 'Range' of object '_Global' failed
    By mjj347 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-24-2012, 11:09 AM
  4. MACRO, ERROR 1004, Method 'Range' of object '_Global' failed
    By ssbhardw in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-08-2010, 03:49 PM
  5. 1004:runtime error method 'range' of object'_Global failed
    By trksbc in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-21-2009, 03:25 AM
  6. Error 1004 Method 'Range' of object '_Global' failed
    By bjwade62 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-07-2006, 11:00 AM
  7. Run-time error '1004': Method 'Range' of object '_Global' failed
    By Neild in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-12-2006, 07:50 PM

Tags for this Thread

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