Results 1 to 7 of 7

subscript out of Range (Run time error 9), need help

Threaded View

  1. #1
    Forum Contributor
    Join Date
    07-17-2012
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    715

    subscript out of Range (Run time error 9), need help

    Hi,

    AM having an error "subscript out of Range (Run time error 9)" in this macro

    Sub ss()
    FileToOpen = Application.GetOpenFilename _
    (Title:="Please Choose the RTCM File", _
    FileFilter:="Excel Files *.xls (*.xls),")
    
    If FileToOpen = False Then
        MsgBox "No file specified.", vbExclamation, "Duh!!!" ' Notification that nothing is chosen
        Exit Sub
    Else ' Load the file, copy the first sheet and paste it in active sheet ...
        ThisWorkbook.Activate
        ThisWorkbook.ActiveSheet.Range("A1:Z65536").ClearContents
        Workbooks(FileToOpen).Activate
        lrow = Workbooks(FileToOpen).Sheets("Sheet1").Cells(65536, 1).End(xlUp).Row
        Workbooks(FileToOpen).Sheets("Sheet1").Range("A1:Z" & lrow).Copy
        ThisWorkbook.Activate
        ThisWorkbook.ActiveSheet.Range("A1").PasteSpecial xlPasteValues
    End If
    End Sub
    I highlighted a line, where i get this error.

    Please help

    Thanks
    Last edited by shiva_reshs; 07-05-2013 at 02:32 PM.

Thread Information

Users Browsing this Thread

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

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