Thread: new macro
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
gocush[_24_] gocush[_24_] is offline
external usenet poster
 
Posts: 1
Default new macro


This sounds like your Totalling sheet is a list of invoices for th
month. Then what you want to do is collect all invoices for eac
company for a monthly statement.

An easy way to do this is to use AutoFilter.

Try using the macro recorder to do this:

Select any cell in your dataset
Turn on the recorder.
Click Data|Autofilter.
In col A select a company
Select the entire range
Insert a new worksheet

Turn off the recorder and look at your new code.


If you make a list of all company names, you can add code to your macr
like this:

Dim oCell as range, x as integer,CompanyName as string
x=sheets.count
For each oCell in Range("CompanyNameList")
CompanyName = oCell.value
....use the code that you recorded....

Copy Destination:= sheet(x).range("A2")
x=x+1
next


this should get you started

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com