Consulting

Results 1 to 5 of 5

Thread: how to remove some range of cell only,

  1. #1
    VBAX Regular
    Joined
    Jan 2011
    Posts
    55
    Location

    how to remove some range of cell only,

    Dear Forum,

    I would like to remove some cells only not the whole line using some criteria ( ie (cell including "LInterf" ) over VBA, so Is it possible?


    To clarify my problem I attached some file for your reference.



    Thx
    Amrane
    Attached Files Attached Files

  2. #2
    Knowledge Base Approver VBAX Guru GTO's Avatar
    Joined
    Sep 2008
    Posts
    3,368
    Location
    Presuming you mean that you do not want to delete the entire Row, what cells are to be deleted, and which way are we shifting cells?

  3. #3
    VBAX Regular
    Joined
    Jan 2011
    Posts
    55
    Location

    Re-how to remove some range of cell only,

    Dear Mr GTO


    Thx for reply,so

    I want to remove those including"LInterf" in the column "M" ( yellow color).

    the other cell will be shifted toward upper way. ( see my privious excel sheet)


    Thx in advance.

    Amrane

  4. #4
    Knowledge Base Approver VBAX Guru GTO's Avatar
    Joined
    Sep 2008
    Posts
    3,368
    Location
    Hi Amrane,

    I still feel I am misunderstanding, but here's an example to see. To delete/shift up the cells you have marked in yellow...

    In a junk copy of your wb:
    Option Explicit
        
    Sub exa()
    Dim wks As Worksheet
    Dim i As Long
        
        Set wks = ThisWorkbook.Worksheets("Sheet1") '<--- Change sheetname to suit
        With wks
            For i = .Cells(.Rows.Count, "M").End(xlUp).Row To 2 Step -1
                If .Cells(i, "M").Value = "LInterf" Then
                    Range(.Cells(i, "D"), .Cells(i, "M")).Delete xlShiftUp
                End If
            Next
        End With
    End Sub

  5. #5
    VBAX Regular
    Joined
    Jan 2011
    Posts
    55
    Location
    Dear GTO

    Great


    Thx, this will solve my headache.

    Amrane

Posting Permissions

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