Please excuse my newness to VB. I have a urgent task for work that I need to complete today, however I am stuck. I didn't think initially that I would need to use VBA to complete the task, but ultimately I do, and I am too new at it to complete it on my own. Below is the code with explanations. Thanks in advance for the help.
Sub Fill_Schedule()
Dim rngCell As Range
Dim rngAddress As String
For Each rngCell In Range("C10:C116") ‘This has the time slots I’m filling
If WorksheetFunction.CountIf(Range("DW11"), rngCell) = 1 Then ‘DW11 is in row 1 of the table and this cell contains the time corresponding to the first available slot in C10:C116
End If
Next
rngAddress = Range("DX11").Value ‘DX11 contains the cell address of the value of DW11
Range(rngAddress) = "Schedule" ‘Writes the word schedule in the cell specified by the value in DX11
End Sub
This code is working fine (although probably not nearly as efficiently as possible), but it only does the first row of the table (Row 11). I need it repeat for however many rows are in the table.
***Important note, it must do 1 row at a time. The results of row 1 affect the slot available for row 2***
Sub Fill_Schedule()
Dim rngCell As Range
Dim rngAddress As String
For Each rngCell In Range("C10:C116") ‘This has the time slots I’m filling
If WorksheetFunction.CountIf(Range("DW11"), rngCell) = 1 Then ‘DW11 is in row 1 of the table and this cell contains the time corresponding to the first available slot in C10:C116
End If
Next
rngAddress = Range("DX11").Value ‘DX11 contains the cell address of the value of DW11
Range(rngAddress) = "Schedule" ‘Writes the word schedule in the cell specified by the value in DX11
End Sub
This code is working fine (although probably not nearly as efficiently as possible), but it only does the first row of the table (Row 11). I need it repeat for however many rows are in the table.
***Important note, it must do 1 row at a time. The results of row 1 affect the slot available for row 2***