This works for me.

Sub SheetName()

    Dim LR As Integer
   For Each ws In ActiveWorkbook.Worksheets
    
       With ws
            If .Name <> ActiveSheet.Name Then
            
              .Range("C2").Value = .Name
            
              LR = .Range("A" & .Rows.Count).End(xlUp).Row
             .Range("C2").AutoFill Range("C2:C" & LR), Type:=xlFillDefault
        
            End If
       End With
   Next
End Sub