Hello,
I run a seat time report for 30 teachers which measures the time they spent online (distinct days).
[TABLE="width: 688"]
<colgroup><col><col><col><col><col></colgroup><tbody>[TR]
[TD]Teacher[/TD]
[TD]Course[/TD]
[TD]Date[/TD]
[TD]Time
(hh:mm)[/TD]
[TD]IP Address[/TD]
[/TR]
[TR]
[TD]Allison, Robert[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD] [/TD]
[TD]*Home Page/eMail/Forum[/TD]
[TD]10/1/2019 5:39 AM[/TD]
[TD]0:00[/TD]
[TD]71.72.124.152[/TD]
[/TR]
[TR]
[TD] [/TD]
[TD]*Home Page/eMail/Forum[/TD]
[TD]10/1/2019 6:44 AM[/TD]
[TD]0:00[/TD]
[TD]71.72.124.152[/TD]
[/TR]
[TR]
[TD] [/TD]
[TD]Math Integrated Math III (1-18)[/TD]
[TD]10/1/2019 6:44 AM[/TD]
[TD]0:03[/TD]
[TD]71.72.124.152[/TD]
[/TR]
[TR]
[TD] [/TD]
[TD]*Home Page/eMail/Forum[/TD]
[TD]10/1/2019 6:47 AM[/TD]
[TD]0:00[/TD]
[TD]71.72.124.152[/TD]
[/TR]
[TR]
[TD] [/TD]
[TD]Math Integrated Math III (1-18)[/TD]
[TD]10/1/2019 6:47 AM[/TD]
[TD]0:06[/TD]
[TD]71.72.124.152[/TD]
[/TR]
[TR]
[TD] [/TD]
[TD]*Home Page/eMail/Forum[/TD]
[TD]10/1/2019 6:53 AM[/TD]
[TD]0:00[/TD]
[TD]71.72.124.152[/TD]
[/TR]
[TR]
[TD] [/TD]
[TD]*Home Page/eMail/Forum[/TD]
[TD]10/1/2019 9:08 AM[/TD]
[TD]0:00[/TD]
[TD]71.72.124.152[/TD]
[/TR]
[TR]
[TD] [/TD]
[TD]Math Integrated Math III (1-18)[/TD]
[TD]10/1/2019 9:08 AM[/TD]
[TD]0:00[/TD]
[TD]71.72.124.152[/TD]
[/TR]
[TR]
[TD] [/TD]
[TD]*Home Page/eMail/Forum[/TD]
[TD]10/1/2019 9:08 AM[/TD]
[TD]0:01[/TD]
[TD]71.72.124.152[/TD]
[/TR]
[TR]
[TD] [/TD]
[TD]Math Integrated Math III (1-18)[/TD]
[TD]10/1/2019 9:09 AM[/TD]
[TD]0:00[/TD]
[TD]71.72.124.152[/TD]
[/TR]
</tbody>[/TABLE]
The date column is a time stamp and I first have to take that data and separate the data the Text to Column function. Then I can take the date column and use Remove Duplicates, leaving me the unique days the teacher was online. My problem is that it works correctly for some teachers and incorrectly for others. Each teacher report is in a separate tab in my workbook. I need to know what I did wrong to make this macro work at times and at not. Any help would be appreciated. Here's the macro code:
Sub DistinctDays()
'
' DistinctDays Macro
'
'
Columns("D:F").Select
Range("D3").Activate
Selection.UnMerge
Columns("B:H").EntireColumn.AutoFit
Range("D6").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Range("A4").Select
Columns("J:J").ColumnWidth = 27.71
Range("J6").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.TextToColumns Destination:=Range("J6"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=False, _
Semicolon:=False, Comma:=False, Space:=True, Other:=False, FieldInfo _
:=Array(Array(1, 1), Array(2, 1), Array(3, 1)), TrailingMinusNumbers:=True
ActiveSheet.Range("$J$6:$J$511").RemoveDuplicates Columns:=1, Header:=xlNo
Columns("E:F").Select
Selection.Delete Shift:=xlToLeft
Columns("I:J").Select
Selection.Delete Shift:=xlToLeft
Range("H4").Select
ActiveCell.FormulaR1C1 = "=COUNTA(R[2]C:R[18]C)"
Range("H5").Select
End Sub
Thank you in advance.
Andy
I run a seat time report for 30 teachers which measures the time they spent online (distinct days).
[TABLE="width: 688"]
<colgroup><col><col><col><col><col></colgroup><tbody>[TR]
[TD]Teacher[/TD]
[TD]Course[/TD]
[TD]Date[/TD]
[TD]Time
(hh:mm)[/TD]
[TD]IP Address[/TD]
[/TR]
[TR]
[TD]Allison, Robert[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD] [/TD]
[TD]*Home Page/eMail/Forum[/TD]
[TD]10/1/2019 5:39 AM[/TD]
[TD]0:00[/TD]
[TD]71.72.124.152[/TD]
[/TR]
[TR]
[TD] [/TD]
[TD]*Home Page/eMail/Forum[/TD]
[TD]10/1/2019 6:44 AM[/TD]
[TD]0:00[/TD]
[TD]71.72.124.152[/TD]
[/TR]
[TR]
[TD] [/TD]
[TD]Math Integrated Math III (1-18)[/TD]
[TD]10/1/2019 6:44 AM[/TD]
[TD]0:03[/TD]
[TD]71.72.124.152[/TD]
[/TR]
[TR]
[TD] [/TD]
[TD]*Home Page/eMail/Forum[/TD]
[TD]10/1/2019 6:47 AM[/TD]
[TD]0:00[/TD]
[TD]71.72.124.152[/TD]
[/TR]
[TR]
[TD] [/TD]
[TD]Math Integrated Math III (1-18)[/TD]
[TD]10/1/2019 6:47 AM[/TD]
[TD]0:06[/TD]
[TD]71.72.124.152[/TD]
[/TR]
[TR]
[TD] [/TD]
[TD]*Home Page/eMail/Forum[/TD]
[TD]10/1/2019 6:53 AM[/TD]
[TD]0:00[/TD]
[TD]71.72.124.152[/TD]
[/TR]
[TR]
[TD] [/TD]
[TD]*Home Page/eMail/Forum[/TD]
[TD]10/1/2019 9:08 AM[/TD]
[TD]0:00[/TD]
[TD]71.72.124.152[/TD]
[/TR]
[TR]
[TD] [/TD]
[TD]Math Integrated Math III (1-18)[/TD]
[TD]10/1/2019 9:08 AM[/TD]
[TD]0:00[/TD]
[TD]71.72.124.152[/TD]
[/TR]
[TR]
[TD] [/TD]
[TD]*Home Page/eMail/Forum[/TD]
[TD]10/1/2019 9:08 AM[/TD]
[TD]0:01[/TD]
[TD]71.72.124.152[/TD]
[/TR]
[TR]
[TD] [/TD]
[TD]Math Integrated Math III (1-18)[/TD]
[TD]10/1/2019 9:09 AM[/TD]
[TD]0:00[/TD]
[TD]71.72.124.152[/TD]
[/TR]
</tbody>[/TABLE]
The date column is a time stamp and I first have to take that data and separate the data the Text to Column function. Then I can take the date column and use Remove Duplicates, leaving me the unique days the teacher was online. My problem is that it works correctly for some teachers and incorrectly for others. Each teacher report is in a separate tab in my workbook. I need to know what I did wrong to make this macro work at times and at not. Any help would be appreciated. Here's the macro code:
Sub DistinctDays()
'
' DistinctDays Macro
'
'
Columns("D:F").Select
Range("D3").Activate
Selection.UnMerge
Columns("B:H").EntireColumn.AutoFit
Range("D6").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Range("A4").Select
Columns("J:J").ColumnWidth = 27.71
Range("J6").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.TextToColumns Destination:=Range("J6"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=False, _
Semicolon:=False, Comma:=False, Space:=True, Other:=False, FieldInfo _
:=Array(Array(1, 1), Array(2, 1), Array(3, 1)), TrailingMinusNumbers:=True
ActiveSheet.Range("$J$6:$J$511").RemoveDuplicates Columns:=1, Header:=xlNo
Columns("E:F").Select
Selection.Delete Shift:=xlToLeft
Columns("I:J").Select
Selection.Delete Shift:=xlToLeft
Range("H4").Select
ActiveCell.FormulaR1C1 = "=COUNTA(R[2]C:R[18]C)"
Range("H5").Select
End Sub
Thank you in advance.
Andy