Hi
I want to be able to start a process to copy cells K9:K67 and paste them to AM9:AM67 continously at the rate of 2 or 4 times a second (if that's possible) Ideally with a start and stop button
Thanks, Paul
Hi
I want to be able to start a process to copy cells K9:K67 and paste them to AM9:AM67 continously at the rate of 2 or 4 times a second (if that's possible) Ideally with a start and stop button
Thanks, Paul
It probably won't funcation exactly the way you want since you are doing it through Excel.
That said, here are some macros to get you started:
Range("K9:K67").Copy Range("AM9:AM67 ")
More info here (TeachExcel tutorial): Excel Copy/Paste with VBA
This is some very generic time code with your copy/paste code inside it.
Dim TimerActive As Boolean
Sub StartTimer()
Start_Timer
End Sub
Private Sub Start_Timer()
TimerActive = True
Application.OnTime Now() + TimeValue("00:00:01"), "Timer"
End Sub
Private Sub Stop_Timer()
TimerActive = False
End Sub
Private Sub Timer()
If TimerActive Then
Range("K9:K67").Copy Range("AM9:AM67 ")
Application.OnTime Now() + TimeValue("00:00:01"), "Timer"
End If
End Sub
Run Start_Timer to start it and Stop_Timer to stop it.
It runs once per second.
I think that once you run this you will not like the result and will choose another route to solve your issue; in that case, please explain your issue better. The fact of the matter is that Excel does not perform this kind of operation well.
Option Explicit
Dim OldVal
Public Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("H9:H16")) Is Nothing Then
Application.EnableEvents = False
OldVal = Target.Value
Application.EnableEvents = True
End If
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("H9")) Is Nothing Then
Application.EnableEvents = False
Range("AN9") = Target.Value - OldVal
Application.EnableEvents = True
End If
If Not Intersect(Target, Range("H10")) Is Nothing Then
Application.EnableEvents = False
Range("AN10") = Target.Value - OldVal
Application.EnableEvents = True
End If
If Not Intersect(Target, Range("H11")) Is Nothing Then
Application.EnableEvents = False
Range("AN11") = Target.Value - OldVal
Application.EnableEvents = True
End If
End Sub