VBA
VBA
Sub StartTimer()
If Not timerActive Then
timerActive = True
currentColumn = 13 ' Column M ka number (13)
Application.OnTime Now + TimeValue("00:01:00"), "CopyAndPasteData"
End If
End Sub
Sub StopTimer()
timerActive = False
On Error Resume Next ' Agar timer nahi chalu hai toh error ko ignore kare
Application.OnTime Now + TimeValue("00:01:00"), "CopyAndPasteData", , False
On Error GoTo 0
End Sub
Sub CopyAndPasteData()
Dim sourceRange As Range
Dim targetRange As Range
' Loop through each cell in the source range and copy to the target column
Dim i As Long
For i = 1 To sourceRange.Rows.Count
targetRange.Cells(i, 1).Value = sourceRange.Cells(i, 1).Value
Next i
currentColumn = currentColumn + 1 ' Move to the next column for the next paste
Application.OnTime Now + TimeValue("00:01:00"), "CopyAndPasteData" ' Restart
timer
End Sub
Sub StartCopying()
' 30 second ka interval set karna
NextCopy = Now + TimeValue("00:00:30")
Application.OnTime NextCopy, "CopyData"
End Sub
Sub StopCopying()
On Error Resume Next
Application.OnTime NextCopy, "CopyData", , False
End Sub
Sub CopyData()
Dim LastCol As Long
Dim CopyRange As Range
Sub Macro1()
' Macro1 Macro
' Keyboard Shortcut: Ctrl + a
' Clear the clipboard (unnecessary as we are not using copy/paste anymore)
Application.CutCopyMode = False
Sub Macro1()
' Macro to copy values from B2:K20 to C2:K20 on Sheet2
Dim sourceRange As Range
Dim targetRange As Range
Dim data As Variant
Dim ws As Worksheet