+ Reply to Thread
Results 1 to 3 of 3

Urgent - Run-Time Error "450"

  1. #1
    Jeff
    Guest

    Urgent - Run-Time Error "450"

    Hello,
    I urgently need help with my VBA procedure. I'm getting the following erro
    msg "Run-time '450'
    Here's my VBA procedure
    Sub trimit()
    Dim a As Long
    Dim myRng As Range
    For a = 7 To 100
    x = Mid(Application.Trim(Cells(a, 1).Range), 12, 20)

    If a Mod 2 = 0 Then
    If Cells(a, 1).Value > 0 Then
    Cells(a, 2).Value = x
    Else
    Cells(a, 2).Value = 0
    End If
    End If
    Next a
    --
    Regards,
    Jeff


  2. #2
    Bob Phillips
    Guest

    Re: Urgent - Run-Time Error "450"

    Sub trimit()
    Dim a As Long
    Dim myRng As Range
    For a = 7 To 100
    x = Mid(Application.Trim(Cells(a, 1).Value), 12, 20)

    If a Mod 2 = 0 Then
    If Cells(a, 1).Value > 0 Then
    Cells(a, 2).Value = x
    Else
    Cells(a, 2).Value = 0
    End If
    End If
    Next a
    End Sub


    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    "Jeff" <[email protected]> wrote in message
    news:[email protected]...
    > Hello,
    > I urgently need help with my VBA procedure. I'm getting the following erro
    > msg "Run-time '450'
    > Here's my VBA procedure
    > Sub trimit()
    > Dim a As Long
    > Dim myRng As Range
    > For a = 7 To 100
    > x = Mid(Application.Trim(Cells(a, 1).Range), 12, 20)
    >
    > If a Mod 2 = 0 Then
    > If Cells(a, 1).Value > 0 Then
    > Cells(a, 2).Value = x
    > Else
    > Cells(a, 2).Value = 0
    > End If
    > End If
    > Next a
    > --
    > Regards,
    > Jeff
    >




  3. #3

    Re: Urgent - Run-Time Error "450"

    Jeff,

    I'm not entirely sure what you're trying to do, but here is some code
    that is similar to yours but does not throw and error. HTH

    Graham

    Sub trimit()
    Dim a As Long
    Dim myRng As Range
    For a = 7 To 100

    Set myRng = Sheets('Sheet1").Range("A7:a100")
    x = Mid(Application.Trim(myRng.Cells(a)), 12, 20)

    If a Mod 2 = 0 Then
    If Cells(a, 1).Value > 0 Then
    Cells(a, 2).Value = x
    Else
    Cells(a, 2).Value = 0
    End If
    End If
    Next a

    End Sub





    Jeff wrote:
    > Hello,
    > I urgently need help with my VBA procedure. I'm getting the following erro
    > msg "Run-time '450'
    > Here's my VBA procedure
    > Sub trimit()
    > Dim a As Long
    > Dim myRng As Range
    > For a = 7 To 100
    > x = Mid(Application.Trim(Cells(a, 1).Range), 12, 20)
    >
    > If a Mod 2 = 0 Then
    > If Cells(a, 1).Value > 0 Then
    > Cells(a, 2).Value = x
    > Else
    > Cells(a, 2).Value = 0
    > End If
    > End If
    > Next a
    > --
    > Regards,
    > Jeff



+ 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