+ Reply to Thread
Results 1 to 2 of 2

Macro Run Time error - Invalid procedure call or argument

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    01-11-2011
    Location
    Milwaukee, WI
    MS-Off Ver
    Excel 2003
    Posts
    107

    Macro Run Time error - Invalid procedure call or argument

    I am trying to figure out why my macro won't work completely. When I reun this, I get a Run-Time error "5" - Invalid procedure call or argument. The first sheet6 changes for the "A" cells but not the B's and sheet 8 & 9 go unchanged. The 17 is referring to the number letters in the workbook name ScheduleTablet!B - Debug highlights Cell.Formula = Left(Cell.Formula, 17) & Right(Cell.Formula, Len(Cell.Formula) - 17) + 21 for sheet6

    Sub ScheduleFWD()
    Dim Cell As Range
    Dim ShtName As String
    Dim i_Len As Integer
    
    ShtName = "ScheduleTablet!B"
    i_Len = Len(ShtName)
    
    Sheet6.Select
    For Each Cell In Range("A5:A8, A11:A14, A18:A21, A24:A27, A31:A34, A37:A40, A45:A48, A51:A54, A58:A61, A64:A67, A71:A74, A77:A80, A85:A88, A91:A94, A98:A101, A104:A107, A111:A114, A117:A120, B2, B42, B82")
        Cell.Formula = Left(Cell.Formula, 17) & Right(Cell.Formula, Len(Cell.Formula) - 17) + 21
    Next Cell
    
    Sheet8.Select
    For Each Cell In Range("A5:A8, A11:A14, A18:A21, A24:A27, A31:A34, A37:A40, A45:A48, A51:A54, A58:A61, A64:A67, A71:A74, A77:A80, A85:A88, A91:A94, A98:A101, A104:A107, A111:A114, A117:A120, B2, B42, B82")
        Cell.Formula = Left(Cell.Formula, 17) & Right(Cell.Formula, Len(Cell.Formula) - 17) + 21
    Next Cell
    
    
    Sheet9.Select
    For Each Cell In Range("A5:A8, A11:A14, A18:A21, A24:A27, A31:A34, A37:A40, A45:A48, A51:A54, A58:A61, A64:A67, A71:A74, A77:A80, A85:A88, A91:A94, A98:A101, A104:A107, A111:A114, A117:A120, B2, B42, B82")
        Cell.Formula = Left(Cell.Formula, 17) & Right(Cell.Formula, Len(Cell.Formula) - 17) + 21
    Next Cell
    End Sub
    Last edited by clundeen; 10-31-2011 at 07:58 PM.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro Run Time error - Invalid procedure call or argument

    Is this issue solved?

+ Reply to Thread

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