IF and For Statements not going through

Viewed 37

For some reason my if statement is not going through. My For Next statement is not working either. I have taken the piece of my code where I am stuck and wore down of trying, I would appreciate if someone could shed some light. I have read about it in the forum but I am not getting to see where the problem is. Below you can see the code:

Dim Sheet_Name As String
Dim loopcounter As Integer
Dim Celda_analysis, Range55, Cell55 As Range

For loopcounter = 1 To 10

Sheet_Name = "Hoja" & loopcounter

    On Error GoTo No_More_Sheets
    If Sheets(Sheet_Name).[A1] <> "" Then
    On Error GoTo 0

        Sheets(Sheet_Name).Activate
    
        Set Celda_analysis = Sheets(Sheet_Name).Range("B2:B8").Find(what:="analysis")
    
        Celda_analysis.Select
    
        Set Range55 = Range(ActiveCell.Offset(1, 0), ActiveCell.Offset(10, 0))
    
        Range55.Select
    
        For Each Cell55 In Range55
    
            If Cell55 <> "" Then
        
                Cell55.Value = 5
        
            Else: End If
        
    Else: End If

Next

No_More_Sheets:

0 Answers
Related