RINCONPAUL
07-21-2016, 05:08 PM
Ref the attachment 'Description' tab:
In Range (A2:L2) data is updated every 2 seconds via 3rd party application. The Names remain the same, but Values may differ each update. I have code that copies and pastes the range (A2:L2) Sheet1 over to Sheet2, row by row. That's the easy bit. However I need to amend the code and add the logic statement:
" If the data in Range (A2:L2) is NOT unique (Unique: There is no duplicate, for each name's cell values, in the ranges previously pasted), then don't copy and paste that name's range, wait till next refresh"
For example 'John.4.3.5' appears in copy Range but is already in the Table, so isn't pasted, however 'Bill.5.2.4' and 'Mary.5.2.4', haven't been previously pasted so they're good to go!
Now reason would say, "Why not apply 'Advanced Filter Unique' after the Table is populated?". Again too easy for my requirements, as another macro is assessing the last 3 Unique pastes and triggering another macro based on what it finds (still on the To Do list!), so it's a continually updating and firing process until the bot is stopped. If I can get past this hurdle with your help, I'll move onto the next problem.
The basic code in need of amendment looks like this:
Dim TimeToRun
Sub StartTimer()
Call ScheduleCopy_R1
End Sub
Sub Copy_R1()
Application.ScreenUpdating = False
Dim copySheet As Worksheet
Dim pasteSheet As Worksheet
Set copySheet = Worksheets("Sheet1")
Set pasteSheet = Worksheets("Sheet2")
copySheet.Range("A2:L2").Copy
pasteSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
Application.CutCopyMode = False
Application.ScreenUpdating = True
StartTimer
End Sub
Sub ScheduleCopy_R1()
TimeToRun = Now + TimeValue("00:00:02")
Application.OnTime TimeToRun, "Copy_R1"
End Sub
Sub StopTimer()
Application.OnTime TimeToRun, "Copy_R1", , False
End Sub
In Range (A2:L2) data is updated every 2 seconds via 3rd party application. The Names remain the same, but Values may differ each update. I have code that copies and pastes the range (A2:L2) Sheet1 over to Sheet2, row by row. That's the easy bit. However I need to amend the code and add the logic statement:
" If the data in Range (A2:L2) is NOT unique (Unique: There is no duplicate, for each name's cell values, in the ranges previously pasted), then don't copy and paste that name's range, wait till next refresh"
For example 'John.4.3.5' appears in copy Range but is already in the Table, so isn't pasted, however 'Bill.5.2.4' and 'Mary.5.2.4', haven't been previously pasted so they're good to go!
Now reason would say, "Why not apply 'Advanced Filter Unique' after the Table is populated?". Again too easy for my requirements, as another macro is assessing the last 3 Unique pastes and triggering another macro based on what it finds (still on the To Do list!), so it's a continually updating and firing process until the bot is stopped. If I can get past this hurdle with your help, I'll move onto the next problem.
The basic code in need of amendment looks like this:
Dim TimeToRun
Sub StartTimer()
Call ScheduleCopy_R1
End Sub
Sub Copy_R1()
Application.ScreenUpdating = False
Dim copySheet As Worksheet
Dim pasteSheet As Worksheet
Set copySheet = Worksheets("Sheet1")
Set pasteSheet = Worksheets("Sheet2")
copySheet.Range("A2:L2").Copy
pasteSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
Application.CutCopyMode = False
Application.ScreenUpdating = True
StartTimer
End Sub
Sub ScheduleCopy_R1()
TimeToRun = Now + TimeValue("00:00:02")
Application.OnTime TimeToRun, "Copy_R1"
End Sub
Sub StopTimer()
Application.OnTime TimeToRun, "Copy_R1", , False
End Sub