Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Deleting non empty rows
This code deletes the row, if the cell in column C IS empty.
Sub SletBlank() On Error Resume Next Columns("C:C").SpecialCells(xlCellTypeBlanks).Enti reRow.Delete End Sub I need it to do it, the other way around. Delete all rows, where the cell in column C IS NOT empty. But there is no xlCellType for "Nonblank". So how do I best do what I want. Jan |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Deleting non empty rows
Hi Jan,
Try: Sub Tester() On Error Resume Next With Range("C:C") .SpecialCells(xlCellTypeConstants).Delete .SpecialCells(xlCellTypeFormulas).Delete On Error GoTo 0 End With End Sub --- Regards, Norman "Jan Kronsell" wrote in message ... This code deletes the row, if the cell in column C IS empty. Sub SletBlank() On Error Resume Next Columns("C:C").SpecialCells(xlCellTypeBlanks).Enti reRow.Delete End Sub I need it to do it, the other way around. Delete all rows, where the cell in column C IS NOT empty. But there is no xlCellType for "Nonblank". So how do I best do what I want. Jan |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Deleting non empty rows
Hi Jan,
I forgot to extend to the entire row: Public Sub Tester() On Error Resume Next With Range("C:C") .SpecialCells(xlCellTypeConstants). _ EntireRow.Delete .SpecialCells(xlCellTypeFormulas). _ EntireRow.Delete On Error GoTo 0 End With End Sub --- Regards, Norman "Norman Jones" wrote in message ... Hi Jan, Try: Sub Tester() On Error Resume Next With Range("C:C") .SpecialCells(xlCellTypeConstants).Delete .SpecialCells(xlCellTypeFormulas).Delete On Error GoTo 0 End With End Sub --- Regards, Norman "Jan Kronsell" wrote in message ... This code deletes the row, if the cell in column C IS empty. Sub SletBlank() On Error Resume Next Columns("C:C").SpecialCells(xlCellTypeBlanks).Enti reRow.Delete End Sub I need it to do it, the other way around. Delete all rows, where the cell in column C IS NOT empty. But there is no xlCellType for "Nonblank". So how do I best do what I want. Jan |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Deleting non empty rows
Hi Norman
Thank you. Your code deletes the contents of the cells, but changing it to .SpecialCells(xlCellTypeConstants).EntireRow.Delet e and so on did the trick. Jan "Norman Jones" skrev i en meddelelse ... Hi Jan, Try: Sub Tester() On Error Resume Next With Range("C:C") .SpecialCells(xlCellTypeConstants).Delete .SpecialCells(xlCellTypeFormulas).Delete On Error GoTo 0 End With End Sub --- Regards, Norman "Jan Kronsell" wrote in message ... This code deletes the row, if the cell in column C IS empty. Sub SletBlank() On Error Resume Next Columns("C:C").SpecialCells(xlCellTypeBlanks).Enti reRow.Delete End Sub I need it to do it, the other way around. Delete all rows, where the cell in column C IS NOT empty. But there is no xlCellType for "Nonblank". So how do I best do what I want. Jan |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Deleting empty rows | New Users to Excel | |||
deleting empty rows | Excel Discussion (Misc queries) | |||
Deleting All Empty Rows | Excel Discussion (Misc queries) | |||
Deleting unwanted and empty rows.... | New Users to Excel | |||
Deleting empty rows | Excel Programming |