Insertar código automáticamente en formulario excel

hola complacido y muy grato contar con tan expertos en este tema.

quiero hacer que de manera automática se me grabe el código en una base de datos de una hoja de excel osea que a medida que registre el dato este se haga de manera secuencial y automática sin tener que digitar el el código por ejemplo si grabo un dato se grabe con código pr-0000001 y si grabo otro se grabe su código pr-0000002 y asi sucesivamente aquí coloco la rutina la cual me graba los datos muchísimas gracias.

Application.ScreenUpdating = False
Sheets("Producción").Activate
Range("a5").Activate
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Activate
Loop
On Error Resume Next
ActiveCell = Textcod
ActiveCell.Offset(0, 1) = Textcod
ActiveCell.Offset(0, 2) = TextBox1
ActiveCell.Offset(0, 3) = Combotipo
ActiveCell.Offset(0, 4) = Combounida
ActiveCell.Offset(0, 5) = Textprese
ActiveCell.Offset(0, 7) = Textcant
ActiveCell.Offset(0, 6) = TextBox2
ActiveCell.Offset(0, 8) = Textprecio
ActiveCell.Offset(0, 9) = Textcosto
ActiveCell.Offset(0, 10) = Textcomestible
ActiveCell.Offset(0, 11) = Textstok
ActiveCell.Offset(0, 12) = Text1
ActiveCell.Offset(0, 13) = Text2
ActiveCell.Offset(0, 14) = Text3
ActiveCell.Offset(0, 15) = Text4
ActiveCell.Offset(0, 16) = Text5
ActiveCell.Offset(0, 17) = Text6
ActiveCell.Offset(0, 18) = Text7
ActiveCell.Offset(0, 19) = Text8
Range("q5").Copy
ActiveCell.Offset(0, 1).PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False

For X = 6 To Range("A" & Rows.Count).End(xlUp).Row
If IsNumeric(Cells(X, 8)) And IsNumeric(Cells(X, 9)) Then
Cells(X, 10) = Cells(X, 8) * Cells(X, 9)
End If
Next

Añade tu respuesta

Haz clic para o