Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting empty rows Felix New Users to Excel 1 February 3rd 09 07:48 AM
deleting empty rows EngelseBoer Excel Discussion (Misc queries) 3 September 7th 08 01:09 AM
Deleting All Empty Rows bodhisatvaofboogie Excel Discussion (Misc queries) 3 May 18th 06 12:36 PM
Deleting unwanted and empty rows.... Jim New Users to Excel 3 July 5th 05 05:21 AM
Deleting empty rows Foss Excel Programming 4 June 4th 04 07:41 AM


All times are GMT +1. The time now is 09:17 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"