Repost:replacing data on a non focused worksheet with calculated data from the same sheet

B

BruceJ

I have the following code:

Public Sub showtimer()
numberofrows = Sheets("15min").UsedRange.Rows.Count
mydate = Sheets("15min").Range("A" & numberofrows)

If DateValue(mydate) = DateValue(Date) Then
With Sheets("15min").Range("A2:G2") 'this needs to be updated with
calculating data
.Parent.Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Resize(1,
7).Value = .Value
End With
Else
With Sheets("15min").Range("A2:G2")
.Parent.Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Resize(1,
7).Value = .Value
End With
MsgBox ("Add Date")
End If
With Sheets("15min").Range("k2:q2")
.Parent.Range("k" & Rows.Count).End(xlUp).Offset(1, 0).Resize(1,
7).Value = .Value
End With

theevent = "showtimer"
incrementTimer
Call OntimeManager("ADD", nowplus, "showtimer", nowplus1)

End Sub

What it does is to copy 2 sections from the top of the page to the bottom of
the page. On row is static (this is what I need to update) and then K-Q had
data that changes.

What I need to do is to replace the section:

If DateValue(mydate) = DateValue(Date) Then
With Sheets("15min").Range("A2:G2") 'this needs to be updated with
calculating data
.Parent.Range("A" & Rows.Count).End(xlUp).Offset(1,
0).Resize(1, 7).Value = .Value
End With
Else
With Sheets("15min").Range("A2:G2")
.Parent.Range("A" & Rows.Count).End(xlUp).Offset(1,
0).Resize(1, 7).Value = .Value
End With
MsgBox ("Add Date")
End If


so that if it is the first time for the day, it will stuff B - G with 0 and
then A with the date and time, and if it is any other entry, it will
replace A with the date/time, b = L current row - L of prev row
C = M current row - M of prev row
D = N current row - N of prev row
etc to G.

I need this to happen while I am focused on a different work sheet. This is
pretty much what is causing me the problems...


Thanks

Bruce
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top