You can detect the last row of data using.... (uses column A to look for
last row, can be changed to any column or you can use index number e.g. for
"A" use 1 etc.)
Lastrow = Cells(Rows.Count,"A").End(xlup).Row
So to put your totals in the next available row, Lastrow + 1
To add the formula use
Cells(Lastrow+1,2).Formula = "=Sum(B5:B" & Lastrow & ")"
You can then copy across the formula into all other columns (use the macro
recorder to get the code)
Finally text each column total for zero
For myCol = 23 to 2 step -1
If Cells(Lastrow+1,myCol).Value = 0 then
Columns(myCol).Delete
End If
Next myCol

Signature
Regards,
Nigel
nigelnospam@9sw.co.uk
> Hi guys,
>
[quoted text clipped - 43 lines]
>
> As always, your help is greatly appreciated
Freddy - 28 Nov 2007 11:41 GMT
Nigel,
This works perfectly
You really helped me out on this one.
> You can detect the last row of data using.... (uses column A to look for
> last row, can be changed to any column or you can use index number e.g. for
[quoted text clipped - 66 lines]
> >
> > As always, your help is greatly appreciated