Hi all,
I'm attaching you an Excel file, which has measurements in sheet DataCam1 and sheet DataCam2. Those measurements, needs to have their own match within both sheets with a maximum desynchronization of 4 seconds. When this condition is not meet, I need to remove the rows that they don't have a match. This means, that row B2 from DataCAm1 needs to have it's match in also row B2 of DataCam2 within 4 seconds max difference. When this condition is not meet, the time that doesn't have a direct match needs to be removed.
In order to know the value to be removed, I calculate the time differences using the sheet "Test". There you can see the times differences between cells B2 and B3 of DataCam1 and then I compare it with the time difference of also cells B2 and B3 of DataCam2. If the time difference is more than 4 seconds, then appears the line to be deleted. The code delete all the rows of DataCam1 and DataCam2 that are previously shown in the sheet Test.
My question here is that I would like to add a loop counter to know how many rows I have deleted in total. And still would be more nice to know how many rows I have deleted in DataCam1 sheet and how many rows I have deleted in DataCam2.
So, is there a way to add the loop counter as it is in my excel file or using a totally diferent code?
My code is:
Thanks you all in advance for your support!
I'm attaching you an Excel file, which has measurements in sheet DataCam1 and sheet DataCam2. Those measurements, needs to have their own match within both sheets with a maximum desynchronization of 4 seconds. When this condition is not meet, I need to remove the rows that they don't have a match. This means, that row B2 from DataCAm1 needs to have it's match in also row B2 of DataCam2 within 4 seconds max difference. When this condition is not meet, the time that doesn't have a direct match needs to be removed.
In order to know the value to be removed, I calculate the time differences using the sheet "Test". There you can see the times differences between cells B2 and B3 of DataCam1 and then I compare it with the time difference of also cells B2 and B3 of DataCam2. If the time difference is more than 4 seconds, then appears the line to be deleted. The code delete all the rows of DataCam1 and DataCam2 that are previously shown in the sheet Test.
My question here is that I would like to add a loop counter to know how many rows I have deleted in total. And still would be more nice to know how many rows I have deleted in DataCam1 sheet and how many rows I have deleted in DataCam2.
So, is there a way to add the loop counter as it is in my excel file or using a totally diferent code?
My code is:
VBA Code:
Sub Macro1()
'
' Macro1 Macro
'
'
Worksheets("Test").Activate
Dim strWsName As String
On Error GoTo skip
Do
strWsName = Range("m1")
Sheets(strWsName).Select
Dim r As Integer
r = Worksheets("Test").Range("N1").Value
Cells(r, 1).Select
Rows(ActiveCell.Row).Delete
Worksheets("Test").Activate
Loop
Exit Sub
skip: Exit Sub
End Sub
Thanks you all in advance for your support!