gyro2222
New Member
- Joined
- Dec 6, 2014
- Messages
- 7
I'm trying to add time spent m-f on a project.
I randomize the data for each day, then add the cells for m-f together and then add this value to a cell which keeps a running total of the weeks.
The macro does this, adds 7 days to the week and repeats.
The macro works well until I try to get the week summary values to replace the summary of the prior weeks.
the odd thing is that if I use the portion to add a cell to the summary cell which is not part of the randomize cell operation, it works OK.
here's the code. I put a 5-second pause in to see what is happening. It appears after it randomizes and produces a sum for the week, the value changes when I try to add it to the prior weekly summary.
it also prints the individual weeks (I've commented that out, but when active, it provides the wrong value)
hope you can help.
Thanks,
Hal
' ctrl T
'
' Keyboard Shortcut: Ctrl+t
'
Range("L3").Select
Selection.Copy
Range("K3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Calculate
Application.Wait (Now + TimeValue("0:00:07"))
'ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Range("ab4") = Range("ab4") + Range("i4")
Range("ab5") = Range("ab5") + Range("i5")
Range("ab6") = Range("ab6") + Range("i6")
.Range("ab7") = Range("ab7") + Range("i7")
'ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End Sub
I randomize the data for each day, then add the cells for m-f together and then add this value to a cell which keeps a running total of the weeks.
The macro does this, adds 7 days to the week and repeats.
The macro works well until I try to get the week summary values to replace the summary of the prior weeks.
the odd thing is that if I use the portion to add a cell to the summary cell which is not part of the randomize cell operation, it works OK.
here's the code. I put a 5-second pause in to see what is happening. It appears after it randomizes and produces a sum for the week, the value changes when I try to add it to the prior weekly summary.
it also prints the individual weeks (I've commented that out, but when active, it provides the wrong value)
hope you can help.
Thanks,
Hal
' ctrl T
'
' Keyboard Shortcut: Ctrl+t
'
Range("L3").Select
Selection.Copy
Range("K3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Calculate
Application.Wait (Now + TimeValue("0:00:07"))
'ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Range("ab4") = Range("ab4") + Range("i4")
Range("ab5") = Range("ab5") + Range("i5")
Range("ab6") = Range("ab6") + Range("i6")
.Range("ab7") = Range("ab7") + Range("i7")
'ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End Sub