I've got a bit of code that puts the worksheet name in cell C2 which works perfectly for all sheets.

I then want to drag this down depending on how many cells there are in cell A, again for all sheets. This doesn't seem to work, it does nothing.

Any ideas?

Sub SheetName()


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


    
    
    End If

    Next
Thanks