bu fonksiyon ile sayfa isminde kayıtlı olan son id numarasını buluruz
Function findLastCount(sheetName As String, Optional ayrac As String = "_") As Integer
Dim lastCount As Integer
Dim Ws As Worksheet
Dim lastUnderlineIndex As Integer
For Each Ws In ActiveWorkbook.Worksheets
If (InStr(Ws.Name, sheetName) > 0) Then
lastUnderlineIndex = InStrRev(Ws.Name, ayrac)
lastCount = CInt(Mid(Ws.Name, lastUnderlineIndex + 1, Len(Ws.Name) - lastUnderlineIndex))
End If
Next Ws
findLastCount = lastCount
End Function
@benbendedeilem
Cevapla