Forum Message

Topic: Re:Re:Re:Excel - removing words at start of cell - replace can't do it
Posted by: Will Watson
Date/Time: 18/03/15 16:04:00

Well, it would not be my first thought but here you go:

Sub Georgie()
    Dim r As Integer, c As Integer, s As String
    Dim ws As Worksheet
    Set ws = ActiveSheet

    ' first row
    r = 1
    ' col to be thrutched
    c = 1
    s = ws.Cells(r, c)
   
   
    While s <> ""
        If Left(s, 9) = "butternut" Then
            s = Mid(s, 10, 999)
        Else
            If Left(s, 6) = "peanut" Then
                s = Mid(s, 7, 999)
            Else
                s = s
            End If
        End If
        ws.Cells(r, c).Formula = s
        r = r + 1
        s = ws.Cells(r, c)
    Wend
   
End Sub


Entire Thread
TopicDate PostedPosted By
Excel - removing words at start of cell - replace can't do it18/03/15 13:31:00 George Turner
   Re:Excel - removing words at start of cell - replace can't do it18/03/15 13:40:00 Dan Murphy
      Re:Re:Excel - removing words at start of cell - replace can't do it18/03/15 15:13:00 Matteo Castagna
   Re:Excel - removing words at start of cell - replace can't do it18/03/15 14:33:00 Will Watson
      Re:Re:Excel - removing words at start of cell - replace can't do it18/03/15 15:05:00 Andrew Cumming
         Re:Re:Re:Excel - removing words at start of cell - replace can't do it18/03/15 15:20:00 Andrew Cumming
      Re:Re:Excel - removing words at start of cell - replace can't do it18/03/15 15:14:00 Matteo Castagna
         Re:Re:Re:Excel - removing words at start of cell - replace can't do it18/03/15 15:21:00 Will Watson
            Re:Re:Re:Re:Excel - removing words at start of cell - replace can't do it18/03/15 15:27:00 Matteo Castagna
      Re:Re:Excel - removing words at start of cell - replace can't do it18/03/15 15:47:00 George Turner
         Re:Re:Re:Excel - removing words at start of cell - replace can't do it18/03/15 16:04:00 Will Watson
            Re:Re:Re:Re:Excel - removing words at start of cell - replace can't do it18/03/15 16:22:00 Matteo Castagna
               Re:Re:Re:Re:Re:Excel - removing words at start of cell - replace can't do it18/03/15 16:33:00 Will Watson
                  Re:Re:Re:Re:Re:Re:Excel - removing words at start of cell - replace can't do it18/03/15 16:34:00 Matteo Castagna
                     Re:Re:Re:Re:Re:Re:Re:Excel - removing words at start of cell - replace can't do it18/03/15 16:37:00 Will Watson
                        Re:Re:Re:Re:Re:Re:Re:Re:Excel - removing words at start of cell - replace can't do it18/03/15 16:53:00 Matteo Castagna
   Re:Excel - removing words at start of cell - replace can't do it18/03/15 15:12:00 Matteo Castagna
      Re:Re:Excel - removing words at start of cell - replace can't do it18/03/15 16:45:00 George Turner
         Re:Re:Re:Excel - removing words at start of cell - replace can't do it18/03/15 16:53:00 Will Watson
         Re:Re:Re:Excel - removing words at start of cell - replace can't do it18/03/15 16:56:00 Matteo Castagna
            Re:Re:Re:Re:Excel - removing words at start of cell - replace can't do it18/03/15 18:35:00 John Ridout
   Re:Excel - removing words at start of cell - replace can't do it18/03/15 18:50:00 Peter Grist

Forum Home