+ Reply to Thread
Results 1 to 5 of 5

Runtime Error '91' when assigning range to variable

  1. #1
    Registered User
    Join Date
    03-24-2021
    Location
    New Jersey, US
    MS-Off Ver
    Office 365
    Posts
    3

    Runtime Error '91' when assigning range to variable

    Hello everyone,

    I am new to the vba/excel syntax and am currently working to debug an issue with a macro.

    Here's the segment of code from the subroutine
    ----------------------------------------------------------------------------------------------------------------
    Please Login or Register  to view this content.
    ------------------------------------------------------------------------------------------------------

    My guess is it thinks:

    Set comRange = comSheet.Range("A1:A" & comEndRange.Row)

    has not been referenced or defined yet, however it has been initiated at the top of the sub.

    Any and all help appreciated.

    Thanks in advance.
    Last edited by tpampalone; 03-24-2021 at 02:55 PM.

  2. #2
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,525

    Re: Runtime Error '91' when assigning range to variable

    Take a little of your precious time and read the Forum Rules. #2 Is interesting for you.

    Re: "the variable"
    Which one would that be?

  3. #3
    Registered User
    Join Date
    03-24-2021
    Location
    New Jersey, US
    MS-Off Ver
    Office 365
    Posts
    3

    Re: Runtime Error '91' when assigning range to variable

    My apologies, hopefully the updating formatting is correct.

  4. #4
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Runtime Error '91' when assigning range to variable

    If ITEMID1 is not found in comRange then comEndRange will be nothing, which will return an error with
    Please Login or Register  to view this content.
    as you cannot get the row number from nothing

  5. #5
    Registered User
    Join Date
    03-24-2021
    Location
    New Jersey, US
    MS-Off Ver
    Office 365
    Posts
    3

    Re: Runtime Error '91' when assigning range to variable

    Thank you. I will investigate this issue and post updates.

+ 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. [SOLVED] Public variable and Runtime error 91: Object Variable or With block variable not set
    By Frank Nunez in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 10-31-2020, 04:02 PM
  2. [SOLVED] Runtime Error 91: Object variable or With block variable not set
    By Andrew.Trevayne in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-21-2018, 09:12 AM
  3. Runtime error 91 on range variable
    By stevoDE in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-05-2017, 10:33 AM
  4. Replies: 7
    Last Post: 05-19-2016, 05:12 AM
  5. [SOLVED] Assigning A Cell Address to A Variable, Using A Variable - Error '1003'
    By ch_abs in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-28-2014, 01:36 PM
  6. [SOLVED] Runtime Error '91': Object variable... When Running in Range Selection
    By Stonesteel15 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 05-01-2012, 09:50 AM
  7. Runtime error 91 when assigning range
    By katarakt in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-24-2005, 09:06 AM

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