ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   delete a cell if (https://www.excelbanter.com/excel-discussion-misc-queries/69316-delete-cell-if.html)

Tim

delete a cell if
 
delete a cell if it contains a spefic word, and shift the row left? i need
the programe to do this automatically? and not to have to do it manually, as
there are 57,000 lines on the sheet, and about 5000 will need to be deleted.

HELP!!

Gary''s Student

delete a cell if
 
Enter and run this macro:

Sub Macro1()
Dim i, j As Long
Dim s, ss As String
ss = "your word"
For i = 10 To 1 Step -1
For j = 10 To 1 Step -1
s = Cells(j, i).Value
If Not (InStr(s, ss) = 0) Then
Cells(j, i).Delete Shift:=xlToLeft
End If
Next
Next
End Sub


As coded it covers 10 rows by 10 columns. Expand it to suit your needs.
--
Gary's Student


"Tim" wrote:

delete a cell if it contains a spefic word, and shift the row left? i need
the programe to do this automatically? and not to have to do it manually, as
there are 57,000 lines on the sheet, and about 5000 will need to be deleted.

HELP!!



All times are GMT +1. The time now is 02:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com