Results 1 to 8 of 8

Thread: Excel Add Text in Cell with already existing text

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #7
    VBAX Tutor
    Joined
    Jan 2008
    Posts
    266
    Location
    wait!
    i just noticed it will add a space in the begining of each cell and osme other problems :-)
    this should delete the problem with the space.

    [vba]
    Sub test()
    txt = ActiveCell.Value
    x = Split(txt, " ")
    j = 0

    For i = 0 To UBound(x)
    If x(i) = "On" And x(i + 1) = "HOLD" Then
    ActiveCell.Value = ""
    While j < i
    If j = 0 Then
    ActiveCell.Value = x(j)
    Else
    ActiveCell.Value = ActiveCell.Value & " " & x(j)
    End If
    j = j + 1

    Wend
    i = UBound(x)
    End If
    Next i
    End Sub




    [/vba]
    Last edited by Ago; 02-21-2008 at 04:36 AM.

Posting Permissions

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