I have the folowing cosde to list sheet RDM TE-ATBA from to the last sheet in Col L1 onwards on sheet macro as well as the values on these sheets that are in C29 in M1 onwards
The macro is not listing all the sheeets from RDM TE-ATBA to the last sheet
It would be appreciated if someone could amend my code
The macro is not listing all the sheeets from RDM TE-ATBA to the last sheet
It would be appreciated if someone could amend my code
Code:
Sub ListChequeAdviseSheets()
Dim ws As Worksheet
Dim lastSheet As Long
Dim i As Long
Dim rowCounter As Long
rowCounter = 1
'Get the last sheet in the workbook
lastSheet = Worksheets.Count
'Loop through the worksheets
For i = Sheets("RDM TE-ATBA").Index To Worksheets.Count
Set ws = Worksheets(i)
'Check if the worksheet name is between "RDM TE-ATBA" and the last sheet
If ws.Name >= "RDM TE -ATBA" And i <= lastSheet Then
'Write the worksheet name to column L
Worksheets("Macro").Cells(rowCounter, 12).Value = ws.Name
'Write the value of cell C29 on the worksheet to column M
Worksheets("Macro").Cells(rowCounter, 13).Value = ws.Range("C29").Value
rowCounter = rowCounter + 1 'Increment the row counter
End If
Next i
End Sub