View Full Version : how to remove some range of cell only,
amrane
01-27-2011, 01:44 AM
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:banghead:?
To clarify my problem I attached some file for your reference.
Thx
Amrane
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?
amrane
01-27-2011, 04:05 AM
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
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
amrane
01-27-2011, 05:43 AM
Dear GTO
Great :friends:
Thx, this will solve my headache.
Amrane
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.