Results 1 to 3 of 3

Thread: Split

  1. #1
    Join Date
    Jan 2005
    Posts
    362

    Unanswered: Split

    I have an excel db with a field "Surname & Name", I want to split Surname and Name and the Name to be at a separate Column the L for example.
    I use this code
    Code:
    sub sep_name()
    Dim x
    Worksheets("Sheet1").Range("A1").Activate  
      iRow = 0
    Do Until 1 = 0 'Endless Loop!
       iRow = iRow + 1
       If ActiveCell.Offset(iRow, 1).Value <> "" Then
          x = Split(ActiveCell.Offset(iRow, 1).Value, " ")
        ActiveCell.Offset(iRow, 11).Value = x(1)
      Else
           Exit Do
      End If  
    Loop
    End Sub
    But this code do that I want only for the first 30-40 fields but there are at least another 40 fields and with that do nothing!
    What is wrong, is there another better solution?

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    If you only want to do it for the first 40 rows change the Do Until to read
    Code:
    Do Until iRow = 40
    George
    Home | Blog

  3. #3
    Join Date
    Jan 2005
    Posts
    362

    Solution

    I copy paste this sheet at another sheet it was ok , Someone made a deletion of some names.
    I do not know if it counts.
    Thank you, I will count this solution.
    I thing I will be ok now.
    Dimis

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •