Copying data from one column to another at periodic interval

ankurm84

New Member
Joined
Jan 28, 2019
Messages
8
Hi...

I have data in column(A) which get updated after a minute. Values in this column(A) are derived values.

What I want is , that data from column (A) will get copied to column(B) after minute and after 2 min, updated value in column(A) should get copied in column(C) and so forth.

I have very limited understanding of VBA.

Tried to follow below thread:
https://www.mrexcel.com/forum/excel-questions/379070-simple-copy-update-cell-value-every-minute.html

but not able to achieve what I am looking for.

This particular code i am using currently, is copying the values , but along with formula used in column A, because of which after 2 mins value in column A,B & C become same:

Option ExplicitPublic dTime As Date


Sub ValueStore()
Dim iCol As Long
Columns(3).Copy Cells(1, Columns.Count).End(xlToLeft).Offset(, 1)
Call StartTimer
End Sub






Sub StartTimer()
dTime = Now + TimeValue("00:01:00")
Application.OnTime dTime, "ValueStore", Schedule:=True
End Sub


Sub StopTimer()
On Error Resume Next
Application.OnTime dTime, "ValueStore", Schedule:=False
End Sub

Any help is greatly appreciated!!

Thanks
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Hi there. Replace your ValueStore subroutine with this:

Code:
Sub ValueStore()
Dim iCol As Long
Columns(1).Copy
Cells(1, Columns.Count).End(xlToLeft).Offset(, 1).PasteSpecial Paste:=xlPasteValues
    Application.CutCopyMode = False

Call StartTimer
End Sub

Regards
John
 
Last edited:
Upvote 0
Thanks a lot John...It worked :)
But somehow my STOP button which uses below sub, has stopped working...any idea why?

Sub StopTimer()
On Error Resume Next
Application.OnTime dTime, "ValueStore", Schedule:=False
End Sub

Thanks,
Ankur
 
Upvote 0
Make sure youve got all the code in one module, and the Public dTime As Date declaration is at the top of it. It is also possible that if you use the STOP button when ValueStore is executing the stop will be ignored.
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,217
Members
452,619
Latest member
Shiv1198

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top