Weekly Totals
Hi Joel
Thanks for replying, I have columns A through to K, column A is a date, B-K
contain amounts taken for various activities, with one row is added each day.
What I am tring to achieve is to atomaticaly add a weekly total row after
each seven days with "Wk total" placed in column A and total columns B-K
If you like I could email a screen shot of the data sheet
Thanks
Tredown
"Joel" wrote:
There isn't enough information to determine where to add the new rows or
which columns need to be totaled. It is easier to see a sample of your data
to be able to write the code.
"Tredown" wrote:
I have a data sheet which is populated from a form on another worksheet by
means of command button. What i would like to do is to add something to the
button code to automaticaly add a total row at the end of every week to the
data sheet.
This is the code use to populate the data sheet
Sub Button1_Click()
Dim smallrng As Range, DestRange As Range
Dim DestSheet As Worksheet, Lr As Long
Dim SourceRange As Range, I As Integer
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
'fill in the Source Sheet and range
Set SourceRange =
Sheets("Sheet1").Range("H2,E5,E6,E7,E8,E9,E10,E11, E12,E13,E14,E15")
'Fill in the destination sheet and call the LastRow
'function to find the last row
Set DestSheet = Sheets("Sheet2")
Lr = LastRow(DestSheet)
I = 1
For Each smallrng In SourceRange.Areas
'We make DestRange the same size as smallrng and use the
'Value property to give DestRange the same values
With smallrng
Set DestRange = DestSheet.Cells(Lr + 1, I) _
.Resize(.Rows.Count, .Columns.Count)
End With
DestRange.Value = smallrng.Value
I = I + smallrng.Columns.Count
Next smallrng
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
Range("C5:D15,C18:D27").Select
Selection.ClearContents
End Sub
Any help would be much appreciated
Thanks
Tredown
|