+ Reply to Thread
Results 1 to 6 of 6

Various errors

  1. #1
    Registered User
    Join Date
    02-09-2005
    Posts
    51

    Post Various errors

    Can someone fix the following for me?
    Dim n as Long
    With ActiveSheet
    For n = 1865 To 1 Step -1
    If (.Cells(n, "d").Value = "S") Then .Cells(n, "e").Select
    End If
    Selection.TextToColumns Destination:=Range(".Cells(n, "e")), DataType:=xl _
    FixedWidth,FieldInfo:=Array(Array(0, 1), Array(7, 1), Array(14, 1), _
    Array(17, 1))
    Next n
    End With

    I get either syntax errors or End If without Block If errors.

  2. #2
    Dave Peterson
    Guest

    Re: Various errors

    Maybe...

    Dim n As Long
    With ActiveSheet
    For n = 1865 To 1 Step -1
    If UCase(.Cells(n, "d").Value) = "S" Then
    .Cells(n, "e").TextToColumns _
    Destination:=.Cells(n, "e"), _
    DataType:=xlFixedWidth, _
    FieldInfo:=Array(Array(0, 1), Array(7, 1), _
    Array(14, 1), Array(17, 1))
    End If
    Next n
    End With

    knowtrump wrote:
    >
    > Can someone fix the following for me?
    > Dim n as Long
    > With ActiveSheet
    > For n = 1865 To 1 Step -1
    > If (.Cells(n, "d").Value = "S") Then .Cells(n, "e").Select
    > End If
    > Selection.TextToColumns Destination:=Range(".Cells(n, "e")),
    > DataType:=xl _
    > FixedWidth,FieldInfo:=Array(Array(0, 1), Array(7, 1), Array(14, 1), _
    > Array(17, 1))
    > Next n
    > End With
    >
    > I get either syntax errors or End If without Block If errors.
    >
    > --
    > knowtrump
    > ------------------------------------------------------------------------
    > knowtrump's Profile: http://www.excelforum.com/member.php...o&userid=19664
    > View this thread: http://www.excelforum.com/showthread...hreadid=503820


    --

    Dave Peterson

  3. #3
    Andrew Houghton
    Guest

    Re: Various errors

    Try this

    Dim n As Long
    With ActiveSheet
    For n = 1865 To 1 Step -1
    If (.Cells(n, "d").Value = "S") Then .Cells(n, "e").Select
    End If
    Selection.TextToColumns Destination:=Range(.Cells(n, "e")),
    DataType:=xlFixedWidth, _
    FieldInfo:=Array(Array(0, 1), Array(7, 1), Array(14, 1), _
    Array(17, 1))
    Next n
    End With


    "knowtrump" <[email protected]> wrote
    in message news:[email protected]...
    >
    > Can someone fix the following for me?
    > Dim n as Long
    > With ActiveSheet
    > For n = 1865 To 1 Step -1
    > If (.Cells(n, "d").Value = "S") Then .Cells(n, "e").Select
    > End If
    > Selection.TextToColumns Destination:=Range(".Cells(n, "e")),
    > DataType:=xl _
    > FixedWidth,FieldInfo:=Array(Array(0, 1), Array(7, 1), Array(14, 1), _
    > Array(17, 1))
    > Next n
    > End With
    >
    > I get either syntax errors or End If without Block If errors.
    >
    >
    > --
    > knowtrump
    > ------------------------------------------------------------------------
    > knowtrump's Profile:
    > http://www.excelforum.com/member.php...o&userid=19664
    > View this thread: http://www.excelforum.com/showthread...hreadid=503820
    >




  4. #4
    Registered User
    Join Date
    02-09-2005
    Posts
    51

    inre Dave Peterson Solution

    Thanks for the help but I still get the End If without block If error.

  5. #5
    Registered User
    Join Date
    02-09-2005
    Posts
    51

    inre Andrew Houghton Solution

    Thanks, ut I still get the End If without block If error.

    Still looking for help if there are any other view of this.

  6. #6
    Tom Ogilvy
    Guest

    Re: Various errors

    Dim n as Long
    With ActiveSheet
    For n = 1865 To 1 Step -1
    If .Cells(n, "d").Value = "S" Then
    .Cells(n, "e").Select
    Selection.TextToColumns Destination:=.Cells(n, "e"), _
    DataType:=xlFixedWidth, _
    FieldInfo:=Array(Array(0, 1), _
    Array(7, 1), Array(14, 1), _
    Array(17, 1))
    End If

    Next n
    End With

    --
    Regards,
    Tom Ogilvy


    "knowtrump" <[email protected]> wrote
    in message news:[email protected]...
    >
    > Thanks, ut I still get the End If without block If error.
    >
    > Still looking for help if there are any other view of this.
    >
    >
    > --
    > knowtrump
    > ------------------------------------------------------------------------
    > knowtrump's Profile:

    http://www.excelforum.com/member.php...o&userid=19664
    > View this thread: http://www.excelforum.com/showthread...hreadid=503820
    >




+ 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