+ Reply to Thread
Results 1 to 9 of 9

Subscript Out of Range

  1. #1
    Forum Contributor
    Join Date
    10-02-2012
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    251

    Subscript Out of Range

    Hi all,

    I'm a little bit baffled by this one, I'm trying to use the following line in my code;

    Please Login or Register  to view this content.
    However where I try to use it, whether it be a variable or directly into the code, I get "Subscript Out Of Range".

    Any idea why this won't work?

    Heres my full macro so you can see how I am using it.

    Please Login or Register  to view this content.
    Many thanks!
    Last edited by PrizeGotti; 06-10-2022 at 06:30 AM.

  2. #2
    Forum Expert CheeseSandwich's Avatar
    Join Date
    12-22-2021
    Location
    Kent, England
    MS-Off Ver
    365 - 2402-17328.20068
    Posts
    1,359

    Re: Subscript Out of Range

    Has the workbook you are running the code from been saved to a folder location?

    Is the workbook you are defining already open?
    If things don't change they stay the same

  3. #3
    Forum Contributor
    Join Date
    10-02-2012
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    251

    Re: Subscript Out of Range

    Hi CheeseSandwich,

    Yes both workbooks are saved to the same folder. But to answer your second question, no, I need to have this working while not have the other workbook open. And I'm guessing thats why I'm going wrong.

    I need to extract data from the other workbook whether its open or not. Is this possible?

  4. #4
    Forum Expert CheeseSandwich's Avatar
    Join Date
    12-22-2021
    Location
    Kent, England
    MS-Off Ver
    365 - 2402-17328.20068
    Posts
    1,359

    Re: Subscript Out of Range

    Are the below sheets that are inside the SrcSheet or are they just in the file you are running the code from?
    Please Login or Register  to view this content.

  5. #5
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,907

    Re: Subscript Out of Range

    You do not include the path when referring to an object in the Workbooks collection.
    Rory

  6. #6
    Forum Expert CheeseSandwich's Avatar
    Join Date
    12-22-2021
    Location
    Kent, England
    MS-Off Ver
    365 - 2402-17328.20068
    Posts
    1,359

    Re: Subscript Out of Range

    I think i can see that they are not part of SrcSheet, maybe the below will help - i have opened the file.

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    10-02-2012
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    251

    Re: Subscript Out of Range

    Quote Originally Posted by CheeseSandwich View Post
    I think i can see that they are not part of SrcSheet, maybe the below will help - i have opened the file.

    Please Login or Register  to view this content.
    This seems to be what I was looking for, my only concern being that it still requires the other workbook to be opened. Unfortunately I have no control whether the "Client" workbook will already be open by another user or not. If another user has the workbook open, will this cause an error?

  8. #8
    Forum Expert CheeseSandwich's Avatar
    Join Date
    12-22-2021
    Location
    Kent, England
    MS-Off Ver
    365 - 2402-17328.20068
    Posts
    1,359

    Re: Subscript Out of Range

    It should just open a read only copy as it would if you opened the file while someone else was in it manually.

    You can change the open line to the below if you always want to open the file read only:
    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    10-02-2012
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    251

    Re: Subscript Out of Range

    You are a legend and a scholar. Many thanks!

+ 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] Assigning range to 2D array: subscript out of range
    By immigrated4urjob in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-04-2022, 03:08 PM
  2. [SOLVED] Named range into array using VBA - Subscript out of range
    By Pak Mariman in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-01-2021, 06:31 AM
  3. Replies: 1
    Last Post: 06-15-2015, 01:56 AM
  4. Subscript out of range error while populating array from range.
    By Aussiexile in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-04-2010, 02:22 AM
  5. Subscript out of range error when trying to select a range
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-01-2010, 07:57 PM
  6. subscript out of range
    By palm101 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-09-2009, 04:13 AM
  7. Subscript out of Range
    By Jon in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-06-2006, 06:30 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