Results 1 to 6 of 6

vba error subscript out of range

Threaded View

  1. #1
    Forum Contributor
    Join Date
    12-25-2011
    Location
    Lahore, Punjab, Pakistan
    MS-Off Ver
    Excel 2010
    Posts
    287

    vba error subscript out of range

    Hello Everyone

    Dim LastRec As Long
    
    Sheets("Data").Select
    LastRec = ThisWorkbook.Sheets("Data").UsedRange.Rows.Count
    
        
        For i = 1 To LastRec
                Cells(i, 3).Select
                StrTxt = Selection.Text
                ActiveCell.Offset(0, 4).Select
                ExTxt = Selection.Text
                    Do Until Cells(i + 1, 4).Value < Cells(i, 4).Value
                    StrTxt = StrTxt & " " & ExTxt
                    i = i + 1
                    Loop
        Next i
    I get error on following line;
    LastRec = ThisWorkbook.Sheets("Data").UsedRange.Rows.Count
    Kindly help
    Last edited by caabdul; 01-29-2018 at 01:28 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Run-time error '9': subscript out of range - error occurs on multiple computers except one
    By BrettE in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-06-2014, 11:19 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. Defining Array - Runtime error 9, Subscript out of range error
    By MaartenW in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-03-2012, 07:32 AM
  4. Runtime Error - Subscript out of range despite On Error statement
    By DoctorG in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-28-2006, 11:05 AM
  5. Subscript out of range error - save copy error
    By bg18461 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-13-2006, 11:53 AM
  6. [SOLVED] Type Mismatch error & subscript out of range error
    By Jeff Wright in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-14-2005, 03:06 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