ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to delete row if value in column J =0 (https://www.excelbanter.com/excel-programming/349227-macro-delete-row-if-value-column-j-%3D0.html)

annep[_5_]

Macro to delete row if value in column J =0
 

I export data from Quickbooks into excel. Quickbooks unfortunately doe
not let me filter the data with two variable, because if should be <0
In Quickbooks you can only filter on = or or <.
So I export this huge data block into excel to then import int
access.

When the data is imported into access, I run a macro which massages th
data into a format access can use.
I now have more then 10,000 rows to copy and it has reached the limi
of some of the computers memory.
Out of the 10,000 or more transactions, there are more 4,000 items wit
the value of zero, which I can get rid of.
I would like to be able to add some lines to go through the rows an
delete all rows where the value in column J=0.
Thank for any help.
Ann

--
anne
-----------------------------------------------------------------------
annep's Profile: http://www.excelforum.com/member.php...fo&userid=1885
View this thread: http://www.excelforum.com/showthread.php?threadid=49708


Toppers

Macro to delete row if value in column J =0
 
Anne,

Try this:

Sub DeleteJisZero()

Dim lastrow As Long, r As Long

lastrow = Cells(Rows.Count, "J").End(xlUp).Row

For r = lastrow To 2 Step -1
If Cells(r, "J") = 0 Then
Rows(r).EntireRow.Delete
End If
Next r

End Sub

HTH

"annep" wrote:


I export data from Quickbooks into excel. Quickbooks unfortunately does
not let me filter the data with two variable, because if should be <0.
In Quickbooks you can only filter on = or or <.
So I export this huge data block into excel to then import into
access.

When the data is imported into access, I run a macro which massages the
data into a format access can use.
I now have more then 10,000 rows to copy and it has reached the limit
of some of the computers memory.
Out of the 10,000 or more transactions, there are more 4,000 items with
the value of zero, which I can get rid of.
I would like to be able to add some lines to go through the rows and
delete all rows where the value in column J=0.
Thank for any help.
Anne


--
annep
------------------------------------------------------------------------
annep's Profile: http://www.excelforum.com/member.php...o&userid=18851
View this thread: http://www.excelforum.com/showthread...hreadid=497087



annep[_6_]

Macro to delete row if value in column J =0
 

Works very nice.
I have another question.
How can I combine the two macros?
I would like for this macro to complete and then run my other macro,
which is Sub ExportGLTrans()?
Thanks,
Anne


--
annep
------------------------------------------------------------------------
annep's Profile: http://www.excelforum.com/member.php...o&userid=18851
View this thread: http://www.excelforum.com/showthread...hreadid=497087


Paul B

Macro to delete row if value in column J =0
 
annep, just add the name to the bottom of the macro, like this,

Sub DeleteJisZero()

Dim lastrow As Long, r As Long

lastrow = Cells(Rows.Count, "J").End(xlUp).Row

For r = lastrow To 2 Step -1
If Cells(r, "J") = 0 Then
Rows(r).EntireRow.Delete
End If
Next r
ExportGLTrans
End Sub


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"annep" wrote in
message ...

Works very nice.
I have another question.
How can I combine the two macros?
I would like for this macro to complete and then run my other macro,
which is Sub ExportGLTrans()?
Thanks,
Anne


--
annep
------------------------------------------------------------------------
annep's Profile:

http://www.excelforum.com/member.php...o&userid=18851
View this thread: http://www.excelforum.com/showthread...hreadid=497087




annep[_7_]

Macro to delete row if value in column J =0
 

Too simple
I love it,
Anne:

--
anne
-----------------------------------------------------------------------
annep's Profile: http://www.excelforum.com/member.php...fo&userid=1885
View this thread: http://www.excelforum.com/showthread.php?threadid=49708



All times are GMT +1. The time now is 04:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com