Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Writing VBA Code to compare lines of the same invoice.

I am trying to write a macro to clean up a spreadsheet of data. I am to a
point where I need to delete multiple rows that have the same invoice number
that don't meet certain criteria. Right now the macro will delete all lines
that have a subCount of 1, this removes all single line entries for that
specific invoice. Then it will remove all debit amounts with a deduction
code greater than 1 (these are deduction paybacks. Now I need to remove all
credit amounts that have a different date than the original payment as these
are deductions made against the same invoice again, but at a later date. My
question is, is there a way to do a loop that will compare a select group of
lines (lines with the same invoice number) and either delete all of them, or
just a select few?

Thank You,
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Writing VBA Code to compare lines of the same invoice.

HI

Set TargetDate equal to the desired date and try this loop:

For Each cell In Selection
If cell.Value < TargetDate Then
cell.EntireRow.Delete
End If
Next

Regards,
Per

"yoshimarine" wrote:

I am trying to write a macro to clean up a spreadsheet of data. I am to a
point where I need to delete multiple rows that have the same invoice number
that don't meet certain criteria. Right now the macro will delete all lines
that have a subCount of 1, this removes all single line entries for that
specific invoice. Then it will remove all debit amounts with a deduction
code greater than 1 (these are deduction paybacks. Now I need to remove all
credit amounts that have a different date than the original payment as these
are deductions made against the same invoice again, but at a later date. My
question is, is there a way to do a loop that will compare a select group of
lines (lines with the same invoice number) and either delete all of them, or
just a select few?

Thank You,

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
Writing a macro to compare columns and return a value Ginny Excel Discussion (Misc queries) 1 June 30th 09 08:28 PM
compare delete and copy lines sal21[_86_] Excel Programming 0 November 24th 05 12:42 PM
Add lines to invoice template yancy Excel Worksheet Functions 0 February 1st 05 12:39 AM
Writing many lines on a same Excel 2000 cell freeposte Excel Discussion (Misc queries) 2 December 8th 04 02:45 PM
Help on writing a code to copy and amend lines Karen Brown[_2_] Excel Programming 2 February 5th 04 05:51 PM


All times are GMT +1. The time now is 03:44 AM.

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"