Hello,
I have this code and I would like it to stop at the last row of the data in each sheet.
Option Explicit
Sub LoopThroughSheets()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ActiveSheet.[d1:d33] = ActiveSheet.Name
On Error Resume Next
ws.Range("d2:d33") = ws.Name
Next ws
End Sub
Can this be done?
Kind Regards
I have this code and I would like it to stop at the last row of the data in each sheet.
Option Explicit
Sub LoopThroughSheets()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ActiveSheet.[d1:d33] = ActiveSheet.Name
On Error Resume Next
ws.Range("d2:d33") = ws.Name
Next ws
End Sub
Can this be done?
Kind Regards
Last edited: