For Each row As DataRow In dt.Rows
For index As Integer = 1 To 9
For Each row2 As DataRow In dtAppAvail.Rows
Dim colName2 As String = row2("Day").ToString.Substring(0, 3) & " " & CType(row2("Date"), Date).ToString("dd/MM")
If dt.Columns(index).ToString = colName2 AndAlso row(0).ToString = row2("Timeslot").ToString Then
row(index) = row2("AppointmentsBooked")
End If
Next
Next
Next
Вот более сжатая версия ...
он использует меньше переменных, которые я предполагаю = меньше памяти, но я сомневаюсь, что вы заметите большую разницу ...