PC Review


Reply
Thread Tools Rate Thread

DELETE ROWS ACCORDING TO FIGURES

 
 
K
Guest
Posts: n/a
 
      6th Feb 2008
Hi, i have data in my spreadsheet from coloumn "A" to coloumn "L" . In
coloumn "G" i have codes and in coloumn "J" i have debit and credit
figures. I want macro which should look into coloumn "G" and coloumn
"J" cells and if there are debit and credit figures in coloumn "J"
cells which relates to same code which is in coloumn "G" cells then
Macro should delete those both rows of debit and credit figures from
Range("A:L")
FOR EXAMPLE:

G J ---------coloumns
15SS -100
15SS 100
15SS 200
JK44 300
JK44 -300
JK44 400

Macro should delete 4 rows from above data which will be 15SS -100 and
15SS 100 then also JK44 300 and JK44 -300. i want macro to delete row
from Range("A:L").
Please can anybody help
 
Reply With Quote
 
 
 
 
Don Guillett
Guest
Posts: n/a
 
      6th Feb 2008
try this
Sub deletecreditdebit()
'On Error Resume Next'probably not needed
For i = Cells(Rows.Count, "g").End(xlUp).Row To 2 Step -1
If Cells(i + 1, "g").Value = Cells(i, "g").Value _
And -Cells(i + 1, "j") = Cells(i, "j") _
And IsNumeric(Cells(i, "j")) Then
Rows(i & ":" & i + 1).delete 'Select
'MsgBox Cells(i, "g")
End If
Next i
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(E-Mail Removed)
"K" <(E-Mail Removed)> wrote in message
news:a0dd66d6-5a13-4343-9452-(E-Mail Removed)...
> Hi, i have data in my spreadsheet from coloumn "A" to coloumn "L" . In
> coloumn "G" i have codes and in coloumn "J" i have debit and credit
> figures. I want macro which should look into coloumn "G" and coloumn
> "J" cells and if there are debit and credit figures in coloumn "J"
> cells which relates to same code which is in coloumn "G" cells then
> Macro should delete those both rows of debit and credit figures from
> Range("A:L")
> FOR EXAMPLE:
>
> G J ---------coloumns
> 15SS -100
> 15SS 100
> 15SS 200
> JK44 300
> JK44 -300
> JK44 400
>
> Macro should delete 4 rows from above data which will be 15SS -100 and
> 15SS 100 then also JK44 300 and JK44 -300. i want macro to delete row
> from Range("A:L").
> Please can anybody help


 
Reply With Quote
 
K
Guest
Posts: n/a
 
      7th Feb 2008
On 6 Feb, 22:26, "Don Guillett" <dguille...@austin.rr.com> wrote:
> try this
> Sub deletecreditdebit()
> * 'On Error Resume Next'probably not needed
> For i = Cells(Rows.Count, "g").End(xlUp).Row To 2 Step -1
> If Cells(i + 1, "g").Value = Cells(i, "g").Value _
> *And -Cells(i + 1, "j") = Cells(i, "j") _
> *And IsNumeric(Cells(i, "j")) Then
> Rows(i & ":" & i + 1).delete * 'Select
> 'MsgBox Cells(i, "g")
> End If
> Next i
> End Sub
>
> --
> Don Guillett
> Microsoft MVP Excel
> SalesAid Software
> dguille...@austin.rr.com"K" <kamranr1...@yahoo.co.uk> wrote in message
>
> news:a0dd66d6-5a13-4343-9452-(E-Mail Removed)...
>
>
>
> > Hi, i have data in my spreadsheet from coloumn "A" to coloumn "L" . In
> > coloumn "G" i have codes and in coloumn "J" i have debit and credit
> > figures. *I want macro which should look into coloumn "G" and coloumn
> > "J" cells and if there are debit and credit figures in coloumn "J"
> > cells which relates to same code which is in coloumn "G" cells then
> > Macro should delete those both rows of debit and credit figures from
> > Range("A:L")
> > FOR EXAMPLE:

>
> > G * * * * * *J ---------coloumns
> > 15SS * *-100
> > 15SS * * 100
> > 15SS * * 200
> > JK44 * * *300
> > JK44 * * -300
> > JK44 * * *400

>
> > Macro should delete 4 rows from above data which will be 15SS -100 and
> > 15SS 100 then also JK44 300 and JK44 -300. i want macro to delete row
> > from Range("A:L").
> > Please can anybody help- Hide quoted text -

>
> - Show quoted text -


Hi Don, Thanks for replying. Your macro works very nice but just want
to tell that i got headings in Row 5 so i want macro to work and start
deleting rows form Row 6 to till down. and other important thing that
some time i dont have credit and debit figures exactly in next cell.
FOR EXAMPLE

G J--------------coloumns
15SS 200
15SS -200
15SS 300
15SS 400
15SS -300

your macro will delet 200 and -200 as they are exactly in next cell
but not deleting the 300 and -300 figure as they are not exactly in
next cell because they have 400 in the middle. can you please let me
know that what should i be doing to cover these two things in your
macro. please note that i cant sort figures in my spreadsheet so i can
have credit and debit figures exactly in next cell as i get data on
daily bases and i need it to be as i feed it in so it easy to work out
in the end.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
add rows figures in a column if selected by a variable Paul Microsoft Excel Worksheet Functions 1 29th Feb 2008 01:42 PM
MACRO FOR DELETING DEBIT AND CREDIT FIGURES ROWS K Microsoft Excel Programming 1 5th Feb 2008 05:10 PM
how to straighten downward rows of figures =?Utf-8?B?UmFqYSBLb3Rh?= Microsoft Word Document Management 2 11th Apr 2006 08:13 PM
Excel formula for summing using figures from adjoining rows stephentimko@my-deja.com Microsoft Excel Worksheet Functions 3 17th Mar 2006 02:26 AM
excel giving wrong figures after 50 rows =?Utf-8?B?TmlzaGFudCBLaGFyZQ==?= Microsoft Excel Crashes 4 8th May 2005 06:20 PM


Features
 

Advertising
 

Newsgroups
 


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