Automatically Delete Rows In Which No Data Exists

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


ADVERTISEMENT

Macro To Automatically Delete Data And Hide Rows

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

If Duplicate Email Exists Delete Next Row And All Rows Containing That Email?

Mar 2, 2013

I have a spreadsheet which contains 30,000 lines Column A contains an email address. This spreadsheet was merged from several and so I know that there are duplicates in it.

How can I look up column A and if an identical value (email address) is found further down the sheet on another row. Delete that duplicate row?

I'm not concerned that the data may not be identical in other columns. If the email is a duplicate delete the next and all other rows that contain that email address.

View 3 Replies View Related

Using VBA To Delete Rows Automatically

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

Automatically Delete Rows With Nothing In Them

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

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 View Related

Excel 2003 :: Separate Data Out Of Column That Exists In Different Rows?

Oct 27, 2013

I know how to separate data into different columns i.e. Marry Johnson into two separate columns; however, I have data in different rows that I need separated into different column. See screen cast [URL]

Using excel 2003 on windows 7 64 bit

View 3 Replies View Related

Automatically Sort A Workbook On Opening And Delete Blank Rows?

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

Automatically Populate Cells If Value Exists Within Range

Mar 22, 2013

I need to summarize some information from a different worksheet. Worksheet A(WS-A) is the summary and worksheet B (WS-B) is the source of information. On WS-B I have a range of values under the title "Materials" which I use to put together an estimate. This range has about 25 rows and not all of them are populated depending on the needs of the particular job.

If it matters, the Materials cells are populated by a drop down "list" from yet another worksheet. On the summary (WS-A) I want to show only the cells from WS-B that have a value in them so that if, within the Materials worksheet, there are only 6 rows that have data in them...only those 6 rows are shown on the summary worksheet.

View 9 Replies View Related

Automatically Update Links Only When File Exists?

Jun 2, 2014

I have a workbook that links to four files. I would like to automatically update the links when the file is opened and if the linked files are not available, don't display a message.

I got the first part done using the Options menu in Excel but can't figure out how to suppress the message when the linked files are not available

View 3 Replies View Related

Delete Row If File Exists?

Aug 22, 2014

I have a list of numbers and I have corresponding text files which I named by using these numbers as reference

is there a possible macro to delete those rows which have corresponding text files by checking in a specific folder if that file name exists

View 2 Replies View Related

VBA Delete If Sheet Exists

Oct 10, 2008

Before closing a workbook I want to check if a sheet called temp exists. If it does then I want to delete it.

View 9 Replies View Related

Delete Worksheet If It Exists

Mar 1, 2007

Does anyone have SIMPLE code for this that can be run in a normal Sub. My worksheet will always be named "Cleaned". I have seen some posts regarding Functions and other things that seem more complicated than necessary.

View 9 Replies View Related

Delete Sheet If It Exists

Jun 1, 2007

i would like to write into a macro the ability to check and see if a sheet named "Pie Chart" exists, and if it does delete it without being prompted whether or not i want to delete it.

View 5 Replies View Related

Delete A Worksheet If Exists Or Present

Jul 27, 2009

How do I delete a worksheet but ONLY if it exists, if it doesn't exist, ignore the command. I'm afraid to mess up the other code in the macro/sub, so here it is...

View 2 Replies View Related

Delete Sheet5 When Workbook Closes If It Exists

Aug 6, 2009

I can delete Sheet5 using this macro. I would like to put this in the workbook so that when I close the workbook it will be activated if Sheet5 exists. If Sheet5 does not exist nothing will happen.

Sub DeleteSheet5 ()
Application.DisplayAlerts = False
Sheets("Sheet5").Delete
Application.DisplayAlerts = True
End Sub

how to mark the post as solved other than go advanced and selecting solved from the drop down menu can you tell me how?

View 9 Replies View Related

Delete Row If Value In Cell Exists In Another Worksheet Column

Oct 22, 2007

I have working data on list sheet and added data on compiled sheet.

I need to match duplicates and delete these rows from compiled sheet.

I've tried coping to the list sheet and use "Remove Duplicates", but it rids me of the data that has been processed and has fills applied.

I'm looking for a macor that can do this work for me without losing data on list sheet.

This data reaches into the thousands and I'm looking to run this off the CASE column.

View 9 Replies View Related

Check If Named Range Exists Before Delete

Nov 29, 2007

I'm trying to check if a named range "ActiveCells" exists before deleting it in VBA but can't seem to get the syntax right, I have tried: If Range("Activecells") Is Nothing Then Resume Next Else: ActiveWorkbook.Names("ActiveCells").Delete

AND

If ActiveWorkbook.Names("Activecells") Is Nothing Then Resume Next Else: ActiveWorkbook.Names("ActiveCells").Delete

Can anyone point me in the right direction? I have tried searching but I can only find threads about checking for named objects or about using the toolbars to add/delete named ranges.

View 2 Replies View Related

Delete Entire Column If Word False Exists?

Apr 9, 2014

I have the following code, but it takes longer than expected to run. Is there anyway to speed this up? I am not sure if autofilter is a option. I just want to search through range A16:Z16 and if the word "FALSE" exists delete the entire column. The word "TRUE" is the only other word that would exist in range A16:Z16

[Code]....

View 6 Replies View Related

Moving Data From Rows To Columns And Delete Repeated Rows

Apr 16, 2014

removing duplicate rows and move other data frm rows to columns.xlsx.

I am attaching a sample excel sheet showing what I need to do.In the first tab, I have a list that includes duplicate rows (first column only). I want to remove those duplicate rows but I don't want to lose the data in the following columns which can be unique or duplicates as well.

see the desired result tab in the sheet to get an idea of what I am looking for as the end result.

Keep in mind that the actual source file I am working with could have up to 50000 row, and the expected results could be around 2000 rows. So nothing can be done manually.

View 5 Replies View Related

Find The Data In Some Rows That Match With One Cell And Automatically Fill The Data

Aug 17, 2009

I want find the data in some rows that same with one or more cell and automatically fill the data. And for more details, I have attached the examp file (Examp.xls).Antoni

View 3 Replies View Related

How To Separate Rows Of Data Automatically

Jun 22, 2013

Let's say I have a document with 10 different sections in it. I download it from another piece of software so there is a header/etc on each page. Each page has the name of a company on it in the A column and the name of a section on it in the cell directly below the company name. (Lets call the sections candy, toys, medicine, etc.) I want to separate the information by creating a new sheet for every section and name it toys_sheet, candy_sheet, medicine_sheet automatically. How could I do this?

View 4 Replies View Related

Automatically Hide Rows That Contain No Linked Data?

Mar 16, 2014

I have two linked workbooks, one containing a large data table, and the other containing individual worksheets that extract the data from the large table via HLOOKUP equations in each cell.

Is there a way to have Excel hide the row of a worksheet if the resulting HLOOKUP result in the cell in that row is empty? Also, if there is data in the cell, can I get Excel to automatically adjust the row height based in the incoming data and not on the HLOOKUP equation?

View 1 Replies View Related

Copy Rows To Worksheet IF Exists

Jun 17, 2009

I have a spreadsheet with columns set up like this: RowName, Date, Value1, Value2, Value3 etc. The date is in format YYYYMMDD. What I am trying to do follows, in some sort of pseduo fashion.

View 2 Replies View Related

Rows Similar Data Divided By Blank Row To Delete Data If There Are 6 Or Less

Apr 2, 2014

I have a lot of rows of data all divided with an empty row and if they are 6 or less all rows need to be entirely deleted any 7 or above need to be kept.

View 2 Replies View Related

Automatically Add Multiple New Rows When Data Entered Into Sheet

Aug 18, 2014

Download the attachment and have a look.

I want there to ALWAYS be 5 FREE/EMPTY rows to be able to enter data into them I also want the black area around the outside to ALWAYS be a further 15 rows in height below that.

Sheet 1 = Simple Example
Sheet 2 = A much larger example
Sheet 3 = Erroneously added data should still extend the sheet by 5 rows each time.

View 5 Replies View Related

Delete All Rows/Data Above This Line

Nov 20, 2008

Let's say I have the following file which is imported via a macro which comes from a txt file. [Apologies it's 7mb zip file] http://www.fileden.com/files/2007/8/...mpNotFixed.zip

The way the txt file is that two rows make up one row, but SAP spits the data out into two rows. Now there are specific things that I need from these tabs. The way i can get this data is to perform sort by descending on the tabs. When you sort by a descending you get the data that i need [at the second half of the worksheet]:

Basically what I want to know when i create a macro, how can i get it do delete all the rows above a specific row. In the attached file, go to DataImport2.
I would like a macro to find the word "English" in column C and then delete all the row's above it. I cannot record this because it copy's the specific cells, which i do not need. DataImport3 is how the data comes out, All i do is sort by descending ... and i need help as stated above to delete all unnecessary data.

View 3 Replies View Related

Delete Last 10 Rows With Data (no Criteria)

Feb 14, 2009

I simply want to delete the last 10 rows containing date from a worksheet. No criteria other than they contain data anywhere in the row.

View 4 Replies View Related

Delete Both Rows If Data Is Duplicated

Oct 26, 2009

I have a worksheet with that I need to delete both rows if the data in one of the columns is the same. I know how to delete the duplicate row, but I need both rows deleted..........

From the example above I would want Rows 1,2 and 10,11 and 12,13 deleted based on the data in column D

View 2 Replies View Related

Macro To Delete Rows With Same Data

Nov 18, 2005

In the sample below I need a macro that will delete the entire rows
where the data is repeated in a given column---that is, that it would delete
the repeat ones, leaving one of them. In this example, in the first set, all
that should be left are two rows which contain ME22N and MR8M in column E.
ME22N is repeated two more times and those rows need to be deleted.

If I could get a macro that would ask for the column to operate in, that would be
great for other spreadsheets where it would not necessarily be column E.

ABC DE
MACLEOLLynn MacLeodP0040104ME22N
MACLEOLLynn MacLeodP0040104ME22N
MACLEOLLynn MacLeodP0040104ME22N
MACLEOLLynn MacLeodP0040104MR8M

MACLEOLLynn MacLeodP0050006MB0A
MACLEOLLynn MacLeodP0050006MB0A
MACLEOLLynn MacLeodP0050006MB0A
MACLEOLLynn MacLeodP0050006ME21N
MACLEOLLynn MacLeodP0050006ME21N
MACLEOLLynn MacLeodP0050006ME21N.............

View 12 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved