Results 1 to 2 of 2

Select Method of worksheet class failed Error - VBA

Threaded View

jeffboy29 Select Method of worksheet... 03-05-2014, 11:31 AM
ajryan88 Re: Select Method of... 03-07-2014, 12:10 AM
  1. #1
    Registered User
    Join Date
    11-28-2013
    Location
    PH
    MS-Off Ver
    Excel 2010
    Posts
    16

    Select Method of worksheet class failed Error - VBA

    Hi,

    I'm encountering Select Method of worksheet class failed Error while running below vba code:

    It failed on Sheets(strSheetName).Select

    Sub mc_Breakout()
    '
    ' Breakout Macro
    '
    
    Dim intI As Integer
    Dim strSheetName As String
    Dim strFileName As String
    Dim RngBal As Range
       
    
    
    On Error GoTo ErrorHandler
    
       Application.ScreenUpdating = False
       Application.DisplayAlerts = False
       
    '    For intI = 3 To Worksheets.Count
        For intI = 3 To 11
        
        strSheetName = Worksheets(intI).Name
        If strSheetName <> "Ls_XLB_WorkbookFile" And strSheetName <> "Ls_AgXLB_WorkbookFile" Then
        
        Sheets(strSheetName).Select
    ' Copy-Paste Values Headings
        Range("B3:B7").Select
        Selection.Copy
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        
    ' Copy-Paste Values Extract Balances
       Range("A1").Select
       
      Set RngBal = Cells.Find(What:="=LOOKUP", LookIn:=xlFormulas, SearchDirection:=xlNext, SearchOrder:=xlByRows)
      
        If RngBal Is Nothing Then
        GoTo NxtProc
        Else
        
        Cells.Find(What:="=LOOKUP", LookIn:=xlFormulas, SearchDirection:=xlNext, SearchOrder:=xlByRows).Select
      
        Range(Selection, Selection.End(xlDown)).Select
        Range(Selection, Selection.End(xlToRight)).Select
        Selection.Copy
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        
        GoTo NxtProc
        
        End If
         
    NxtProc:
     
        Range("B1").Select
              
    'Protect Sheet
            ActiveSheet.Protect ("fr2007")
            Content = ActiveSheet.Name
            
            Ofcname = Sheets("Parameter").Range("B6").Value
            DateString = Format(Now, "yyyy-mm-dd")
            Sheets(strSheetName).Copy
      
            ActiveWorkbook.SaveAs ThisWorkbook.Path & "\" & Ofcname & "_" & Content & "_" & DateString & ".xls", FileFormat:=xlNormal, _
                        Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
                        CreateBackup:=False
           
            ActiveWorkbook.Close
        
        End If
         
         Next intI
         
         MsgBox "Report Completed.  Please check folder for generated files"
         
         Application.ScreenUpdating = True
        
        ActiveWorkbook.Saved = True
        Application.DisplayAlerts = True
        Application.Workbooks.Close
        Application.Quit
        
    Exit Sub
    
    ErrorHandler:
       MsgBox Error(Err)
    End Sub


    I need to select sheets T0 – T9 & PN.

    (Please see attached file)

    The following sheets are not visible & don’t need to select:

    Sheet 12 (tmpscrapsheet)
    Sheet 13 (Ls_XLB_WorkbookFile)
    Sheet 14 (Ls_AgXLB_WorkbookFile)

    Hope you can help me.


    Thanks!

    Jeff
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Run time error 1004 select method of worksheet class failed
    By ayvee0 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-14-2013, 10:12 AM
  2. Select Method of Range Class failed error 400
    By kmknowles in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-06-2012, 05:26 PM
  3. [SOLVED] Select method of range class failed error
    By sa02000 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-07-2012, 10:13 AM
  4. select method of range class failed error
    By johndough185 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-06-2007, 08:36 AM
  5. [SOLVED] Error Message "Select method of worksheet class failed"
    By philc in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-04-2005, 04:06 AM

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