LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Weekly Totals

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
 
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
how to create weekly totals Kamra Excel Worksheet Functions 1 January 30th 10 03:22 PM
Weekly Totals Based on Dates JerryS Excel Worksheet Functions 1 July 14th 08 12:15 AM
Weekly Totals on sheet Jerry Excel Programming 8 September 7th 06 01:09 AM
Summing Weekly Totals into Monthly Totals steph44haf Excel Worksheet Functions 3 July 5th 06 04:51 PM
How can I subtotal my weekly totals by months? steph44haf Excel Worksheet Functions 1 July 5th 06 03:01 AM


All times are GMT +1. The time now is 11:29 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"