I need to work on the workbook in Excel that contains hundreds of specific worksheets. I created this simple code to get the list of names of all these worksheets in the one called "Spis faktur". The code runs well but is horribly slow. It seems like it executed the one name of specific worksheet in 0,3 second so it takes ages before it finishes to executed the of all names of worksheets.
Sub ListSheets()
Dim sh As Worksheet
Const txt = "Spis faktur"
Set sh = Sheets(txt)
For i = 1 To Worksheets.Count
sh.Cells(i + 1, 1) = ThisWorkbook.Sheets(i).Name
Next i
End Sub
Would be grateful for any piece of advice what could be wrong with this code.