Hello,
I have a worksheet that has the names of the employees in the area of the company I work in, called Employees. Each employee has their own worksheet (the name of the sheet is the name of the employee). The purpose of the for looping is to search the Employees worksheet for employee names and make changes to their respective worksheets if a given condition is met. But Excel returned with the error Subscript out of range (Error 9). Why is this error ocurring? The error is in the red line of the code.
With Plan2
EndRwPlan2 = .Cells(.Rows.Count, "B").End(xlUp).Row
End With
For i = 15 To EndRwPlan2
Sheets("" & Plan2.Cells(i, 3).Value).Select
With Sheets("" & Plan2.Cells(i, 3).Value)
EndRwPlanind = .Cells(.Rows.Count, "B").End(xlUp).Row
End With
For j = 15 To EndRwPlanind
If Sheets("" & Plan2.Cells(i, 3).Value).Cells(j, 2).Value = Plan5.Cells(20, 50).Value Then
Sheets("" & Plan2.Cells(i, 3).Value).Activate
Sheets("" & Plan2.Cells(i, 3).Value).Cells(j, 4).Value = TextBox1.Value
Sheets("" & Plan2.Cells(i, 3).Value).Cells(j, 6).Value = TextBox2.Value
Sheets("" & Plan2.Cells(i, 3).Value).Cells(j, 7).Value = TextBox3.Value
Sheets("" & Plan2.Cells(i, 3).Value).Cells(j, 8).Value = TextBox4.Value
Sheets("" & Plan2.Cells(i, 3).Value).Cells(j, 9).Value = TextBox5.Value
Sheets("" & Plan2.Cells(i, 3).Value).Cells(j, 10).Value = TextBox6.Value
Sheets("" & Plan2.Cells(i, 3).Value).Cells(j, 11).Value = TextBox7.Value
Sheets("" & Plan2.Cells(i, 3).Value).Cells(j, 12).Value = TextBox8.Value
End If
Next j
Next i
Bookmarks