How to get this to start in row 2

[Closed]
Report
-
Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
-
Hello,

I like the code that makes the sheetnames appear in a new sheet
Sub SheetNames()
For i = 1 To Worksheets.Count
ActiveSheet.Cells(i, 1).Value = Worksheets(i).Name
Next i
End Sub


But how to i get this to start in the second row , when i run this macro now on a blank sheet, it starts in A cell 1, can i have it start in A cell 2 ?

Thanks

1 reply

Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
768
Sub SheetNames()
Dim lRow as Long
    lRow = 1
    For i = 1 To Worksheets.Count
        lRow = lRow + 1
        ActiveSheet.Cells(lRow, 1).Value = Worksheets(i).Name
    Next i
End Sub