#1   Report Post  
Posted to microsoft.public.excel.misc
Tim
 
Posts: n/a
Default 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!!
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student
 
Posts: n/a
Default 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!!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
delete a cell if it contains specific word Tim Excel Discussion (Misc queries) 1 February 2nd 06 04:31 PM
VBA Excel Macro to delete contents in named cell reaa Excel Discussion (Misc queries) 1 January 3rd 06 08:16 PM
Delete row based on contents of cell AndyG Excel Discussion (Misc queries) 6 November 17th 05 10:08 PM
How do I delete the automatically inserted ' in every Excel cell? SLW Excel Discussion (Misc queries) 6 August 24th 05 03:17 PM
cell color index comparison MINAL ZUNKE New Users to Excel 1 June 30th 05 07:11 AM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"