Automatically Delete Rows That Contain A Certain Word
May 15, 2007
I can trying to let the user type a word in to cell A1 and then have Excel remove the rows that contain the word. But VBA below just seem to delete all nonblank rows?
sub delete2()
Range("a2:a200").Select
For Each cell In Selection
If cell.Value = A1 Then
cell.ClearContents
End If
Next cell
Range("a2:a200").Select
Selection.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
end sub
how I can update this code?
View 9 Replies
ADVERTISEMENT
Mar 4, 2014
How can I delete all rows that have a cell that starts with the letters APP
View 3 Replies
View Related
Dec 18, 2013
I get a report each week that has a bunch of unwanted header info. It used to be static and the macro just deleted the first 49 rows. I recently found out that the header format changed and it's been deleting crucial data.
I need something that will find the words "Medical Center" and delete all the rows above it, however many that may be...
View 4 Replies
View Related
Jan 27, 2009
I need to build a macro which will look for a specific word say :"ABC" in a particular column say "B" and delete 5 rows including the row containing the word "ABC"
View 6 Replies
View Related
Aug 31, 2012
I am trying to get macro which will find word "Service" in sheet 1 and after that delete that row and below row.
View 1 Replies
View Related
Jul 22, 2008
I have a spreadsheet that I need VBA Code to do the following
1) Delete all rows where the word totals appears in Column B for eg "Totals for Vehicles Stocked in 0706" "Totals for Vehicles Stocked in 0707" etc
2) Delete all rows where the value in col m is less than 45
I have written the code, but cannot get it to work-see my code below
Sub Del_TOTALS_Underaged()
FinalRow = Cells(65536, 2).End(xlUp).Row
For i = FinalRow To 1 Step -1
If Cells(i, 2).Value >= "Totals" Then
Cells(i, 1).EntireRow.Delete
If Cells(i, 13).Value < "45" Then
Cells(i, 1).EntireRow.Delete
End If
End If
Next i
End Sub
View 9 Replies
View Related
Oct 5, 2009
I have got an excel sheet with 2 columns A and B.
Column A's rows are merged according to column B. E.g.
Column A:
Row 1-7 (merged) Ron
Column B:
Row 1: New Jersey
Row 2: New Delhi
Row 3: New Jersey
Row 4: New York
Row 5: New York
Row 6: New Jersey
Row 7: New York
My result should be like:
Column A:
Row 1: Ron
Column B:
Row 1: New York
and similarly for other rows also.
PS: The no. of rows merged for column A can be different.
Also the keyword that should be present in Column B should be according to hierarchy, New York, New Delhi and then New Jersey i.e. first the macro should check for New York, if its present (in 1st 7 rows according to example given) then New York should be written in Coulmn B, if New York is not present then it should check for New Delhi and New Delhi should be written in Column B and if New York and New Delhi both are not present then it should check for New Jersey.
There are only 3 keywords which need to be checked i.e. New York, New Delhi and New Jersey.
If these 3 keywords are not present then the macro should not do anything.
View 9 Replies
View Related
Aug 13, 2007
What I need VBA to do is scan the data in a certain column (in this case column I entitled "Type") and if it picks up a certain letter (either a "C" "D" or "K") in a range starting from row 2 then Delete the whole row and condense them so I am only left with the data that corresponds to letters "E" and "R"...
Does there exist a macro that can accomplish this for me; the alternative doesn't even bare thinking about as the range can be anything up to row 6k
I have tried looking on the Net and have seen example of similiar macros, alas I'm completely new to this and cannot adapt it to my needs.
View 9 Replies
View Related
Jul 7, 2004
I have a spreadsheet where I would like to automatically delete rows with nothing in them. Here is a typed up example:
BEFORE
Column A
row 1 99999
row 2
row 3 99999
row 4
row 5 99999
AFTER
Column A
row 1 99999
row 2 99999
row 3 99999
row 4
row 5
The spreadsheets I am dealing with have 100's of rows so it is difficult to search through the spreadsheet and delete the rows with nothing in them.
View 9 Replies
View Related
Jan 14, 2007
I have some code that works almost perfectly. I am trying to automatically delete rows in which no data exists in cells in a certain column.
the problem that I am having is that is seems to go into an infinite loop.
For example, if I delete row 5 and then iterate to the next row, row 5 becomes what used to be row 6 and now my code is on row 6...essentially skipping a row.
Here is an example data set (note that the set is for 20 rows):
1
3
6
15
36
37
here is the
Sub Macro2()
r = 20
Min = 1
Do While r >= Min
If Cells(r, 1) = "" Then
Cells(r, 1).EntireRow.Delete
Else
r = r - 1
End If
Loop
End Sub
View 9 Replies
View Related
Dec 20, 2008
I have a spreadsheet that allows room for 35 students per period, but instead of having the teacher manually go in and delete the extra data and hide the rows, I want to create a macro that will do so.
In cell B4 the teacher will enter how many students are in their first period class. (cell C4 for second period, cell D4 for third etc...) I want the entering of the number to automatically hide the superfluous rows and delete the data in the second column for those rows. I don't want the rows to be completely deleted because another year they may have more students and need those rows back.
I have attached one of the workbooks that I need to put this macro into. I have created room for 35 students in a given period. So if they have 23 students entered into B4 (period one) I would need rows 30-41 to be hidden, and I would need the formulas in B30:B41, E30:E41, H30:H31, K30:K31 etc....deleted.
Basically the point of the formulas is the teacher will enter the total points possible on that given assignment in cell B6, E6, H6 etc....and it autofills that score down, so the teacher only enters those that missed points instead of entering in the missed ones and the 100 percent ones.
I would need those formulas to be deleted because if the assignment was out of 10 then cell B30-B41 will give students a 10, and then the class average will be computing those scores,but those students don't exist.
But if I can't get the macro to auto delete the formulas, I will just not have those formulas in there, and the teacher can enter all scores.
View 9 Replies
View Related
Jul 4, 2013
I am trying to educate myself in the wonders of Excel (2003) and an struggling somewhat.I have a small project loosely based on a shops stock control and have attached a copy of the workbook -
The user normally only has access to columns B, C and E due to the others being locked and the sheet protected.I would like the sheet to be automatically sorted based on column E each time the workbook is opened.I then need to automatically delete a row once an item in column B has been removed (made blank)
View 3 Replies
View Related
Mar 9, 2007
I am trying to make a simple program that will go down column A deleting the rows until it meets a cell with the word "Date" in the A column. When it has found that row I want it to delete that row also and then stop.
This is what I have so far
Sub FindAndDelete()
Dim row As Integer
Dim col As Integer
ActiveSheet.Range("a1").Select
If Range("a1") "date" Then Rows("1:1").Select
Selection.Delete
End Sub
I tried defining row =1
col = 1
and then going if range ("rowcol") but no joy.
View 9 Replies
View Related
Mar 25, 2014
I am trying to populate the 2 tables from excel to word. I will be getting the excel file with tables in various sheets. One sheet consist of 2 tables that will be inserted to one word document. So if there are 2 sheets then I will have the tables inserted in the 2 word document. In the excel sheet I have attached, there are 2 sheets with tables in each of them. I have written the code to copy and paste the table to word doc from (general) range A1:G4 (Table 1) and A9:H18 (Table 2) that has empty rows and columns selected. But there are empty rows and columns inserted since the table range is not same sheetwise. I would like get the empty rows and columns deleted in the word table.
Find the attached sample excel sheet and the word documents.
DeleteEmptyRows(Sample).xlsx
Sheet1.doc
Sheet2.doc
View 2 Replies
View Related
Apr 24, 2009
Is there any formula to write digits convert into word ?
Eg: - Can 1020 Convert into "One thousand twenty" with the help of any formula ?
View 9 Replies
View Related
Sep 28, 2009
I need a little assistance opening a Word file via an Excel macro. The two files are linked and upon opening, the Word file asks if the links should be updated. I need this to automatically be "Yes" everytime the file is opened.
View 4 Replies
View Related
Jul 20, 2008
On the data sheet I attached you can see easily what I am trying to do:
The macro should do something like this basically:
Column A there is a entry like "L110E (CST_PRG-Wheel Loaders-E series models)"
Lets say we have 10.000 entries more or less like this.
Macro should do this:
* Take first word for example in this case "L110E" and copy into column D same row.
* Take second word's second part in this case only "PRG" and copy into column B same row.
* Take the 3rd word between - - in this case only "Wheel Loaders" and copy into column C.
View 10 Replies
View Related
Apr 9, 2012
I am trying to make an excel vba reference the word 12.0 object library automatically without the user having to manually add them. How I can do this?
View 2 Replies
View Related
Aug 10, 2009
I have created an Excel spreadsheet that collects info from a userform; we are using this as a issue log.
However, at the same time, upon completion of the log, the engineer then needs to fill out the essentially the same information in a Word form for sending off to the customer. I was thinking that perhaps this could be done by using a mail merge but from past experience this generally isn't very user friendly or quick.
Is it possible to automate this somehow using VBA such that when Enter is clicked on the form, not only does it fill in the next available line in the log spreadsheet but it also opens Word and populates the required fields with this same info?
View 9 Replies
View Related
Apr 5, 2014
I'm trying to make a spreadsheet template that will find and replace all instances of a given word with a bold or highlighted version. However, I do not know how to make this process passive and automated. That is, as soon as I type certain words, they should be auto-corrected. Is there a way to set excel so it will recognize certain words and replace them? Is there a way to do this in the settings? I don't think a macro is the right answer in this case, so I put it in the general thread.
View 5 Replies
View Related
Sep 24, 2013
I have a Sheet1 and I need to delete the entire row(s) that contain the word "BUYER" located in column A using VBA.
View 5 Replies
View Related
Jan 4, 2008
There is a word art pic in my excel file and i tried all options to get rid but could not do it.
View 9 Replies
View Related
May 8, 2014
I am trying to find the word ''New'' and then delete row.Here is my current code below...
[Code]....
My code works fine upuntil Loopwhile.
The reason for this, on this particular occasion there is only one line containing 'new' so the code has nothing to loop....
So I need to re write
[Code] ....
In order to account for the possibility only one row ft's the word 'New'
Also might be worth mentioning the word New could ft in amongst other data in the particular cell.
View 3 Replies
View Related
Jan 24, 2013
I have a file in which the data is written in cell.
1g Injection Total
10mg Tablets Total
1.5% w/w Gel Total
i want the to delete the word "Total" from each cell so that i can use the vlookup formula to get the desired result from another file.if there is any solution.looking forward for the an easy and understandable reply.
View 4 Replies
View Related
May 5, 2009
I'm trying to figure out the best way to pull information from different worksheets. One field which I require has slight alterations between the sheets. I'd like to delete everything in the cell except for the very first word.
Here is a simple example (and I'd have this all through column A for instance)
Cell A1 = Multiple words here
Lets say I want to delete everything in the cell except the word "multiple"
View 6 Replies
View Related
Jun 9, 2009
I am trying to find a macro that deletes a row that does not contain a given word or string.
For example, if a row does not contain the string -> then delete it or even better select and move all such rows to another worksheet so that the main worksheet is left only with rows containing the string.
View 7 Replies
View Related
Apr 24, 2012
Looking for a VBA code that deletes rows based on the word Yes. Column P to be precise
I have a Validation List in Column P and when the user will select "Yes" I need to have it delete the row that row. Any quick code?
View 2 Replies
View Related
Sep 9, 2013
For example, on cell A1 I have 123456 Total, how do I delete the word "Total"? I have abut 2000 lines. What formula do I use?
View 5 Replies
View Related
Feb 12, 2009
I want to delete a specific words from string but i have a problem with the code below. For example, i wan to delete the word "Inc" only but the problem with my code is that it is deleting from "Incorporated" too and i want only the code to delete only if it finds the word "Inc" only.
View 11 Replies
View Related
Dec 12, 2009
In range A1:A300 I have a lotof words. What I want is to delete entire row if the cell value is Open date
View 3 Replies
View Related