Consulting

Results 1 to 5 of 5

Thread: remove word

  1. #1

    Post remove word

    In table I have to remove row with word 'esp' from column 5
    emp 23 34 45 esp 11
    chk 11 22 12 ntk 11
    jkl 23 45 99 esp 22

  2. #2
    VBAX Regular
    Joined
    Jan 2012
    Posts
    24
    Location
    try this

    [VBA]
    Sub deleteesp()
    Application.DisplayAlerts = False
    Dim sheetnum As Integer

    Sheets("Sheet1").Select
    With ActiveSheet
    Lastrow_Track = .Cells(.Rows.Count, "O").End(xlUp).Row
    End With
    Sheets("Sheet1").Select
    With ActiveSheet
    Lastrow_CB_Err = .Cells(.Rows.Count, "A").End(xlUp).Row
    End With

    row_track = 1
    For Row = 0 To 3
    If Sheets("Sheet1").Cells(row_track, 5).Value Like "esp" Then
    Sheets("Sheet1").Cells(row_track, 5).Value = " "
    End If
    row_track = row_track + 1
    Next
    End Sub
    [/VBA]

  3. #3
    Hi,
    I am not able to delete the row with that word, only particular word is deleted

  4. #4

  5. #5
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    [VBA]Sub Test()
    Dim i As Long
    For i = Cells(Rows.Count, 5).End(xlUp).Row To 1 Step -1
    If Cells(i, 5) = "esp" Then Cells(i, 5).EntireRow.Delete
    Next
    End Sub[/VBA]
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

Posting Permissions

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