Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
Can anyone write me a quick VBA example to delete an entire row if a particular cell within that row is empty? I need excel to do this to multiple rows until it gets to the end of the data. Anyone? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub Dirty()
Dim L As Long For L = 200 To 1 Step -1 If Cells(L, 1).Formula = "" Then Rows(L).Delete Next End Sub HTH. Best wishes Anyone "simsjr" skrev i melding ... Hello, Can anyone write me a quick VBA example to delete an entire row if a particular cell within that row is empty? I need excel to do this to multiple rows until it gets to the end of the data. Anyone? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Public Sub DeleteRowOnCell()
''delete any row that has a blank in selected column Set coltocheck = Application.InputBox(prompt:= _ "Select A Column", Type:=8) coltocheck.SpecialCells(xlCellTypeBlanks).EntireRo w.Delete End Sub Gord Dibben Excel MVP On Wed, 18 Aug 2004 15:15:01 -0700, simsjr wrote: Hello, Can anyone write me a quick VBA example to delete an entire row if a particular cell within that row is empty? I need excel to do this to multiple rows until it gets to the end of the data. Anyone? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Option Explicit Sub TEST() Dim RNG As Range If TypeName(Selection) < "Range" Then GoTo e: If Selection.Areas.Count 1 Then GoTo e: LOOP_1: On Error Resume Next Set RNG = Application.InputBox(Prompt:="Select a Range", _ Default:=Selection.Address, Type:=8) If Err.Number 0 Then GoTo e: On Error GoTo 0 If RNG.Cells.Count = 1 Then If Len(RNG) = 0 Then RNG.EntireRow.Delete Else RNG.Columns(1).SpecialCells(xlCellTypeBlanks).Enti reRow.Delete End If e: End Sub - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- Reagrds, Soo Cheon Jheong _ _ ^ ^ ~ |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can be more detailed that this, but it can get you
going in the right direction. 'Understand that you must determine how many columns are necessary to check Sub Delete_Rows () r = 1 'Check each Row Do If Not IsEmpty(Cells(r,c)) Then 'Check each column within that row Do Until c = 7 'Checks until the 7th column If IsEmpty(Cells(r,c + 1)) Then Cells(r,c).EntireRow.Delete Else c = c + 1 End If Loop End If 'Set up for next row c = 1 r = r + 1 Loop Until IsEmpty(Cells(r,c)) 'Assumes that at least column A will not be missing data. End Sub ---Original Message----- Hello, Can anyone write me a quick VBA example to delete an entire row if a particular cell within that row is empty? I need excel to do this to multiple rows until it gets to the end of the data. Anyone? . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VBA code to delete rows | Excel Discussion (Misc queries) | |||
Quick Macro question - How to delete two rows then skip one - and repeat | Excel Discussion (Misc queries) | |||
Is there a quick way to delete all duplicate rows in a column? | Excel Discussion (Misc queries) | |||
code to delete rows | Excel Discussion (Misc queries) | |||
macro to delete entire rows when column A is blank ...a quick macro | Excel Programming |