你本来的代码就没问题啊。
For Each tt As DataRow In DataTables("时间表").DataRows
Dim d1 As Date = tt("开始时间")
Dim d2 As Date = tt("结束时间")
Dim d3 As Date = d1
Dim w1 As Integer = 0
Dim w2 As Integer = 0
Dim w3 As Integer = 0
Dim w4 As Integer = 0
Dim w5 As Integer = 0
Do While d3<= d2
Select Case d3.DayOfWeek
Case 1
w1 = w1 +1
Case 2
w2 = w2 +1
Case 3
w3 = w3 +1
Case 4
w4 = w4 +1
Case 5
w5 = w5 +1
End Select
d3 =d3.AddDays(1)
Loop
Select Case tt("星期")
Case "星期一"
tt("天数") = w1
Case "星期二"
tt("天数") = w2
Case "星期三"
tt("天数") = w3
Case "星期四"
tt("天数") = w4
Case "星期五"
tt("天数") = w5
End Select
Next