Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
ChuckW
 
Posts: n/a
Default Deleting excess data in a macro

Hi,

I am downloading a report from Quickbooks that gives me
transaction details such as Customer Name, Date, Item
Number, Item Name, QTY and Total. Quickbooks then
provides a subtotal for each customer. In this row, all
of the other data in blank (there is not name, date, item
number etc in this row. What I want to do is to create a
macro that only has the transaction data in it and strips
out the subtotals. What I have done is to sort the
workbook by data which give me what I want. However, at
the end of the spreadsheet is all of the subtotals by
themselves with the blank data in all of the other
columns. I would like to delete these somehow. The
problem is that there is no set row that they start on.
One day it will be row 3465 and the next it will be
3531. I then plan to import this into Access but I don't
want the subtotal data to be imported and I can't figure
out how to filter it out during the import. Can anyone
help?

Thanks,

Chuck
  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default

Chuck,

Finding the last row is simple

cLastRow = Cells(Rows.Count,"A").End(xlUp).Row

To delete the rows, you need some identifying criteria, and then delete from
the bottom up, like so

For i = cLastRow to 1 Step -1
If Cells(i,"A").Value = "criteria" Then
Cells(i,"A").EntireRow.Delete
End If
Next i

This technique works without the data being sorted. B y being sorted, you
might be able to stop earlier.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"ChuckW" wrote in message
...
Hi,

I am downloading a report from Quickbooks that gives me
transaction details such as Customer Name, Date, Item
Number, Item Name, QTY and Total. Quickbooks then
provides a subtotal for each customer. In this row, all
of the other data in blank (there is not name, date, item
number etc in this row. What I want to do is to create a
macro that only has the transaction data in it and strips
out the subtotals. What I have done is to sort the
workbook by data which give me what I want. However, at
the end of the spreadsheet is all of the subtotals by
themselves with the blank data in all of the other
columns. I would like to delete these somehow. The
problem is that there is no set row that they start on.
One day it will be row 3465 and the next it will be
3531. I then plan to import this into Access but I don't
want the subtotal data to be imported and I can't figure
out how to filter it out during the import. Can anyone
help?

Thanks,

Chuck



  #3   Report Post  
ChuckW
 
Posts: n/a
Default

Bob,

Thanks for your help. Is this VB code that you are
giving me. I don't know too much about VB. Should I
somehow insert it into my macro?

Thanks,

Chuck

-----Original Message-----
Chuck,

Finding the last row is simple

cLastRow = Cells(Rows.Count,"A").End(xlUp).Row

To delete the rows, you need some identifying criteria,

and then delete from
the bottom up, like so

For i = cLastRow to 1 Step -1
If Cells(i,"A").Value = "criteria" Then
Cells(i,"A").EntireRow.Delete
End If
Next i

This technique works without the data being sorted. B y

being sorted, you
might be able to stop earlier.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"ChuckW" wrote in

message
...
Hi,

I am downloading a report from Quickbooks that gives me
transaction details such as Customer Name, Date, Item
Number, Item Name, QTY and Total. Quickbooks then
provides a subtotal for each customer. In this row,

all
of the other data in blank (there is not name, date,

item
number etc in this row. What I want to do is to

create a
macro that only has the transaction data in it and

strips
out the subtotals. What I have done is to sort the
workbook by data which give me what I want. However,

at
the end of the spreadsheet is all of the subtotals by
themselves with the blank data in all of the other
columns. I would like to delete these somehow. The
problem is that there is no set row that they start on.
One day it will be row 3465 and the next it will be
3531. I then plan to import this into Access but I

don't
want the subtotal data to be imported and I can't

figure
out how to filter it out during the import. Can anyone
help?

Thanks,

Chuck



.

  #4   Report Post  
Bob Phillips
 
Posts: n/a
Default

Chuck,

Yes it is VBA. If you aren't to clear, show us the code you already have and
we'll look at it.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"ChuckW" wrote in message
...
Bob,

Thanks for your help. Is this VB code that you are
giving me. I don't know too much about VB. Should I
somehow insert it into my macro?

Thanks,

Chuck

-----Original Message-----
Chuck,

Finding the last row is simple

cLastRow = Cells(Rows.Count,"A").End(xlUp).Row

To delete the rows, you need some identifying criteria,

and then delete from
the bottom up, like so

For i = cLastRow to 1 Step -1
If Cells(i,"A").Value = "criteria" Then
Cells(i,"A").EntireRow.Delete
End If
Next i

This technique works without the data being sorted. B y

being sorted, you
might be able to stop earlier.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"ChuckW" wrote in

message
...
Hi,

I am downloading a report from Quickbooks that gives me
transaction details such as Customer Name, Date, Item
Number, Item Name, QTY and Total. Quickbooks then
provides a subtotal for each customer. In this row,

all
of the other data in blank (there is not name, date,

item
number etc in this row. What I want to do is to

create a
macro that only has the transaction data in it and

strips
out the subtotals. What I have done is to sort the
workbook by data which give me what I want. However,

at
the end of the spreadsheet is all of the subtotals by
themselves with the blank data in all of the other
columns. I would like to delete these somehow. The
problem is that there is no set row that they start on.
One day it will be row 3465 and the next it will be
3531. I then plan to import this into Access but I

don't
want the subtotal data to be imported and I can't

figure
out how to filter it out during the import. Can anyone
help?

Thanks,

Chuck



.



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
Extract specific data into its own workbook via macro? Adrian B Excel Discussion (Misc queries) 2 February 24th 05 06:09 AM
External data Macro Problem Excel 97 Craig Kelly Excel Discussion (Misc queries) 1 January 17th 05 03:17 PM
Macro does not run when data refreshed Larry Lehman Excel Discussion (Misc queries) 0 January 16th 05 07:31 PM
Pulling data from 1 sheet to another Dave1155 Excel Worksheet Functions 1 January 12th 05 05:55 PM
Daily Macro to Download Data, Order and paste in order Iarla Excel Worksheet Functions 1 November 17th 04 01:59 PM


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