I am extreemly new to VBA so excuse any issues with my question.
My process steps are as follows;
Check all dates within row 3 (at times there are several same dates in the row, i wish to check all) and see if it matches cell A1
if the date matches, check the name in row 4 (directly under the date) matches cell B1.
if both match then write "Yes" directly under, i.e. row 5
if no name found. then add a column with the date and name and write yes
if no date is found, add a column with the date and name and write yes
This will then be looped for all dates and names in column A and B
My Issues
I can't seem to figure out a way to check all dates before i move on to the next if statement - therefore i end up in a continuous loop and my excel crashes.
Example of what i've done so far
Sub Macro1()
Dim cel_1 As Range
Dim cel_2 As Range
For Each cel_1 In Range("3:3")
If cel_1.Value = Range("A1") Then
cel_1.Range("A2").Select
AddInfo:
'if we find the date then we need to ensure if the team member is already there
For Each cel_2 In Selection
If cel_2.Value = Range("B1") Then
'if the team member is there we will input all information over current information
cel_2.Offset(1, 0).Range("A1") = "Yes"
Else
'insert column to the right
ActiveCell.Offset(0, 1).Columns("A:A").EntireColumn.Insert _
Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
'label the week number, date and name
ActiveCell.Offset(-1, 1) = ActiveCell.Offset(-1, 0)
ActiveCell.Offset(0, 1) = ActiveCell.Offset(0, 0)
ActiveCell.Offset(1, 1).Select
GoTo AddInfo:
End If
Next cel_2
End If
Next cel_1
End Sub