bonjour, j'ai un problème mon code ne fonctionne pas et je ne vois pas ou est le soucis.
Sub ajoutercode()
Dim wste As worsheet
Dim wsDash As Worksheet
Dim lastRow As Long
Dim newID As Long
Dim lastvalue As Variant
On Error GoTo errorhabdler
Set wste = ThisWorkbook.Sheets("database")
Set wsDash = thisworksbook.Sheets("dashdoard")
lastRow = wsto.Cells(wsto.Rows.Count, "A").End(xlUp).Row
If lasrow < 3 Then
MsgBox "Ajouter le code manuellement comme de :1000"
Exit Sub
End If
lastvalue = wsto.Cells(lastRow, "1").Value
If latmeric(lastvalue) Then
newID = lastvalue + 1
Else
MsgBox "Le code trouvé dans la colonne A n'est pas numérique."
Exit Sub
End If
wsDash.Range("D1").Value = newID
Exit Sub
errordandler:
MsgBox " An error occurred:" & Err.Description
End Sub
Sub ajoutercode()
Dim wste As worsheet
Dim wsDash As Worksheet
Dim lastRow As Long
Dim newID As Long
Dim lastvalue As Variant
On Error GoTo errorhabdler
Set wste = ThisWorkbook.Sheets("database")
Set wsDash = thisworksbook.Sheets("dashdoard")
lastRow = wsto.Cells(wsto.Rows.Count, "A").End(xlUp).Row
If lasrow < 3 Then
MsgBox "Ajouter le code manuellement comme de :1000"
Exit Sub
End If
lastvalue = wsto.Cells(lastRow, "1").Value
If latmeric(lastvalue) Then
newID = lastvalue + 1
Else
MsgBox "Le code trouvé dans la colonne A n'est pas numérique."
Exit Sub
End If
wsDash.Range("D1").Value = newID
Exit Sub
errordandler:
MsgBox " An error occurred:" & Err.Description
End Sub