Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
bernard
 
Posts: n/a
Default Deleting Rows using Macros

I need to format a sheet every month into a format that can be imported into
our accounting system - I plan to do this using macros.

The sheet contains a number of rows that are not to be imported into the
system and I wish to delete these - the rows to be deleted are those where
column D contains no value.

The spreadsheet has a different number of rows each month. Can anyone advise
how this can best be done.

Thanks in advance.
  #2   Report Post  
Bernie Deitrick
 
Posts: n/a
Default

bernard,

Sub DeleteRows()
Range("D:D").SpecialCells(xlCellTypeBlanks).Entire Row.Delete
End Sub

This will only work if the cells are truly blank - not filled with a formula that returns "".

HTH,
Bernie
MS Excel MVP


"bernard" wrote in message
...
I need to format a sheet every month into a format that can be imported into
our accounting system - I plan to do this using macros.

The sheet contains a number of rows that are not to be imported into the
system and I wish to delete these - the rows to be deleted are those where
column D contains no value.

The spreadsheet has a different number of rows each month. Can anyone advise
how this can best be done.

Thanks in advance.



  #3   Report Post  
bernard
 
Posts: n/a
Default

Excellent, worked a treat! Thanks again.

"Bernie Deitrick" wrote:

bernard,

Sub DeleteRows()
Range("D:D").SpecialCells(xlCellTypeBlanks).Entire Row.Delete
End Sub

This will only work if the cells are truly blank - not filled with a formula that returns "".

HTH,
Bernie
MS Excel MVP


"bernard" wrote in message
...
I need to format a sheet every month into a format that can be imported into
our accounting system - I plan to do this using macros.

The sheet contains a number of rows that are not to be imported into the
system and I wish to delete these - the rows to be deleted are those where
column D contains no value.

The spreadsheet has a different number of rows each month. Can anyone advise
how this can best be done.

Thanks in advance.




  #4   Report Post  
Ron de Bruin
 
Posts: n/a
Default

I like to add this

Use a on error in the code, this avoid a error if there are no blanks

On Error Resume Next

' code

On Error GoTo 0

Note: The limit of SpecialCells is 8192 separate areas



--
Regards Ron de Bruin
http://www.rondebruin.nl


"bernard" wrote in message ...
Excellent, worked a treat! Thanks again.

"Bernie Deitrick" wrote:

bernard,

Sub DeleteRows()
Range("D:D").SpecialCells(xlCellTypeBlanks).Entire Row.Delete
End Sub

This will only work if the cells are truly blank - not filled with a formula that returns "".

HTH,
Bernie
MS Excel MVP


"bernard" wrote in message
...
I need to format a sheet every month into a format that can be imported into
our accounting system - I plan to do this using macros.

The sheet contains a number of rows that are not to be imported into the
system and I wish to delete these - the rows to be deleted are those where
column D contains no value.

The spreadsheet has a different number of rows each month. Can anyone advise
how this can best be done.

Thanks in advance.






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
Find duplicate rows then deleting them SSHO_99 Excel Worksheet Functions 4 May 4th 07 11:17 AM
auto deleting defined rows LoriM Excel Discussion (Misc queries) 4 August 4th 05 06:20 PM
Converting formula to value and deleting rows using macros. Pank Excel Discussion (Misc queries) 4 July 15th 05 09:58 AM
Deleting unwanted and empty rows.... Jim New Users to Excel 3 July 5th 05 05:21 AM
Deleting Macros Mike Excel Worksheet Functions 2 May 25th 05 04:54 PM


All times are GMT +1. The time now is 01:03 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"