Count cells by weekdays

Macro Title:
Worksheet Variable:
Result Variable:
Row Date Reference Variable:
Row Weekday and Output Reference Variable:
Worksheet Name:
Column Reference:
enter the column reference from which you want to count by weekdays
First Row Reference:
enter the first row reference which represents the first row of the range from which you want to count the number of cells that contain a weekday
Last Row Reference:
enter the last row reference which represents the last row of the range from which you want to count the number of cells that contain a weekday
First Row Reference:
enter the first row reference which represents the first row which captures the weekday number and the output
Last Row Reference:
enter the last row reference which represents the last row of the range which the workday number and output
Column Reference of weekday number:
enter the column reference that captures the number of the weekday
Output Column Reference:
First Comment:

'
Second Comment:

'
Third Comment:

'
Sub Count_cells_by_weekdays()
'declare a variable
Dim ws As Worksheet
Set ws = Worksheets("Analysis")
'specify the row that captures the weekday for which to count and the row where to return the output
For y = 14 To 18
counter = 0
'count cells with the date that represents each weekday
For x = 5 To 11
If Weekday(ws.Range("B" & x), 2) = ws.Range("C" & y) Then
counter = counter + 1
End If
Next x
ws.Range("D" & y) = counter
Next y

End Sub

Sub Count_cells_by_weekdays()
'declare a variable

Dim ws As Worksheet

Set ws = Worksheets("Analysis")
'specify the row that captures the weekday for which to count and the row where to return the output

For y = 14 To 18

counter = 0
'count cells with the date that represents each weekday

For x = 5 To 11

If Weekday(ws.Range("B" & x), 2) = ws.Range("C" & y) Then
counter = counter + 1
End If
Next x
ws.Range("D" & y) = counter
Next y

End Sub

Sub Count_cells_by_weekdays()
'declare a variable
Dim ws As Worksheet
Set ws = Worksheets("Analysis")
'specify the row that captures the weekday for which to count and the row where to return the output
For y = 14 To 18
counter = 0
'count cells with the date that represents each weekday
For x = 5 To 11
If Weekday(ws.Range("B" & x), 2) = ws.Range("C" & y) Then
counter = counter + 1
End If
Next x
ws.Range("D" & y) = counter
Next y

End Sub