B
bagerard
Guest
Bonjour à tous,
Voilà, j'ai écrit une macro afin de simplifier au maximum la saisie de relevés dans un fichier excel (plus de 200 lignes et 10 colonnes à remplir par ligne)
Le voici:
Sub saisie()
Dim numCol As Long
Dim numLig As Long
Dim strSaisie As String
Dim nomfen As String
' Boucle sur ligne
For numLig = 2 To ActiveCell.SpecialCells(xlCellTypeLastCell).Row
' Boucle de la colonne A à J
For numCol = 11 To 24
' Pas de question pour certaines colonnes
If numCol <> 15 Then
If numCol <> 16 Then
If numCol <> 19 Then
If numCol <> 20 Then
If numCol <> 23 Then
nomfen = Cells(numLig, 4) & " " & Cells(numLig, 5) & " " & Cells(numLig, 2) & " " & Cells(numLig, 3)
strSaisie = InputBox(Cells(1, numCol) & " ?", nomfen)
' Si saisie effectuée
If strSaisie <> "" Then
Cells(numLig, numCol).Value = strSaisie
End If
End If
End If
End If
End If
End If
Next numCol
Select Case MsgBox("Continuer de saisir ?", vbYesNo, " ")
Case vbOK
Next numLig
Case vbNo
Exit Sub
End Select
End Sub
evidemment s'il fonctionnait, je ne vous embêterais pas avec ça.
Mon souci (à part être une nullité en vba 😕) est que je voudrais qu'excel me propose d'arrêter ou de poursuivre la saisie avant de changer de ligne.
En espérant avoir été assez clair.
Voilà, j'ai écrit une macro afin de simplifier au maximum la saisie de relevés dans un fichier excel (plus de 200 lignes et 10 colonnes à remplir par ligne)
Le voici:
Sub saisie()
Dim numCol As Long
Dim numLig As Long
Dim strSaisie As String
Dim nomfen As String
' Boucle sur ligne
For numLig = 2 To ActiveCell.SpecialCells(xlCellTypeLastCell).Row
' Boucle de la colonne A à J
For numCol = 11 To 24
' Pas de question pour certaines colonnes
If numCol <> 15 Then
If numCol <> 16 Then
If numCol <> 19 Then
If numCol <> 20 Then
If numCol <> 23 Then
nomfen = Cells(numLig, 4) & " " & Cells(numLig, 5) & " " & Cells(numLig, 2) & " " & Cells(numLig, 3)
strSaisie = InputBox(Cells(1, numCol) & " ?", nomfen)
' Si saisie effectuée
If strSaisie <> "" Then
Cells(numLig, numCol).Value = strSaisie
End If
End If
End If
End If
End If
End If
Next numCol
Select Case MsgBox("Continuer de saisir ?", vbYesNo, " ")
Case vbOK
Next numLig
Case vbNo
Exit Sub
End Select
End Sub
evidemment s'il fonctionnait, je ne vous embêterais pas avec ça.
Mon souci (à part être une nullité en vba 😕) est que je voudrais qu'excel me propose d'arrêter ou de poursuivre la saisie avant de changer de ligne.
En espérant avoir été assez clair.