+ Reply to Thread
Results 1 to 2 of 2

How do I Fix Subscript out of range Error when Using Range object with Thousands of Rows?

  1. #1
    Registered User
    Join Date
    04-10-2012
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    16

    How do I Fix Subscript out of range Error when Using Range object with Thousands of Rows?

    Hello Everyone I was working on trying to write a routine that would redact sensitive information in reports that that would have varying degrees of rows and columns. It uses a collection as a master list of qualifiable columns to redact and searches for them in the report. If a match is found it then finds the column and address. Creates a string range address for that column which is used in the line


    Please Login or Register  to view this content.
    However, I get a Subscript out of range runtime error for the For Each line above. I was wondering what is causing this when I have thousands of rows to redact butit will work when there are only a few rows to redact.


    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor
    Join Date
    03-21-2013
    Location
    cyberia
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: How do I Fix Subscript out of range Error when Using Range object with Thousands of Ro

    On a quick look it seems your worksheet names may be somewhat confused.

    Before the 3 lines add: Sheets("Sheet1").Activate
    or alternatively
    For Each Cell In ActiveSheet.Range(sTempRange)
    ...

    and see what happens.

    Have you verified that in fact there is a range named Range(sTempRange) on Sheet1?

+ 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] Error 09 - Subscript out of Range - For Workbooks.sheets Object
    By Marceltcm in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-12-2013, 08:03 PM
  2. Runtime Error - Subscript out of Range / Object Error
    By JHRice in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-04-2012, 05:14 PM
  3. Subscript out of range error for creating object.
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-03-2012, 12:07 PM
  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. Window Object - Subscript out of Range
    By Helen in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-30-2006, 10:35 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