Off the top of my head, something like this?
sub create_totals()
dim i,n,x as integer
i = 2
do until sheets("Sheet1").cells(i,1) = ""
n = 2
x = 1
do until sheets("Sheet2").cells(n,2) = ""
if sheets("Sheet2").cells(n,2) = Sheets("Sheet1").cells(i,1)
then x = n
n = n + 1
n = n + 1
if x = 1 then x = n
sheets("sheet2").cells(x,2) = sheets("Sheet1").cells(i,1)
sheets("Sheet2").cells(x,3) = sheets("Sheet2").cells(x,3) +
sheets("Sheet1").cells(i,2)
i = i + 1
loop
end sub
That will look down column A of "Sheet1" and add all the names to column B
of "Sheet2" and in column C of "Sheet2" add in whatever is in column B of
"Sheet1" so
Job1 100
Job2 50
Job1 60
Job3 15
Job2 70
will end up as
Job1 160
Job2 120
Job3 15
"Freddy" wrote:
> Yeah I mean something that is automated.
>
> I am trying to build a template that will be sent out to various people all
> year round for population.
>
> The macro buttons are to speed things up for them as they seem incapable of
> doing anything themselves.
>
> "PaulW" wrote:
>
> > Make sure the columns have headers and create a Pivot Table? Or do you mean
> > something else?
> >
> > "Freddy" wrote:
> >
> > > I have a table of columns, some titles, others costs.
> > >
> > > Think I may need to email the files to someone to better demonstrate it.
> > >
> > > Is it possible to create a macro button that will create an additional sheet
> > > that summarises all the headings in column 1 and sums their respective costs
> > >
> > > Then another button on the new sheet that will export the data into a
> > > template in their correct columns.
> > >
> > > I would greatly appreciate anyone's help
> > >
> > >
|