Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to create a macro that deletes every blank row in a spreadshee
Hi,
This may do the trick. Call the function that follows like so (test before running live): Sub TestDelete() Call RowsJoinData(5) '<where column 5 (E) is blank for every row to delete end sub Public Function RowsJoinData(argColumn As Integer) 'DELETES ENTIRE ROW WHERE CRITERIA CELL IS BLANK Dim lX As Long Dim lCount As Long Application.ScreenUpdating = False ActiveSheet.DisplayAutomaticPageBreaks = False Application.Calculation = xlCalculationManual lCount = ActiveSheet.UsedRange.Rows.Count For lX = lCount To 1 Step -1 If Cells(lX, argColumn).FormulaR1C1 = "" Then Rows(lX).EntireRow.Delete End If Next lX Application.ScreenUpdating = True ActiveSheet.DisplayAutomaticPageBreaks = True Application.Calculation = xlCalculationAutomatic End Function HTH/ "Grd" wrote: Hi I have a 4000 row spreadsheet with approximately 33 columns and I have about about 300 intermittent blank lines. How can create a macro in the file to automate the process of deleting these empty rows which I do manually? I don't want to use the autofilter function to deal with this problem. I would if possible to do this with a button or shortcut. Anyone can help me this. Thanks very much in advance Janet |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to create a macro that deletes every blank row in a spread
Worked great
Thanks very much "quartz" wrote: Hi, This may do the trick. Call the function that follows like so (test before running live): Sub TestDelete() Call RowsJoinData(5) '<where column 5 (E) is blank for every row to delete end sub Public Function RowsJoinData(argColumn As Integer) 'DELETES ENTIRE ROW WHERE CRITERIA CELL IS BLANK Dim lX As Long Dim lCount As Long Application.ScreenUpdating = False ActiveSheet.DisplayAutomaticPageBreaks = False Application.Calculation = xlCalculationManual lCount = ActiveSheet.UsedRange.Rows.Count For lX = lCount To 1 Step -1 If Cells(lX, argColumn).FormulaR1C1 = "" Then Rows(lX).EntireRow.Delete End If Next lX Application.ScreenUpdating = True ActiveSheet.DisplayAutomaticPageBreaks = True Application.Calculation = xlCalculationAutomatic End Function HTH/ "Grd" wrote: Hi I have a 4000 row spreadsheet with approximately 33 columns and I have about about 300 intermittent blank lines. How can create a macro in the file to automate the process of deleting these empty rows which I do manually? I don't want to use the autofilter function to deal with this problem. I would if possible to do this with a button or shortcut. Anyone can help me this. Thanks very much in advance Janet |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro deletes row in range, macro then skips the row moved up | Excel Discussion (Misc queries) | |||
Save using Macro but test to see if an error appears on spreadshee | Excel Discussion (Misc queries) | |||
Macro that deletes every third row....+ | Excel Discussion (Misc queries) | |||
WHEN DOWNLOADING A TEXTFILE EXCEL DELETES BLANK ROWS - STOP THIS? | Excel Worksheet Functions | |||
Macro that deletes certain rows and not others | Excel Programming |