MISTERJUNGLE
XLDnaute Occasionnel
BONJOUR LE FORUM,
J'ai un souci avec une une formule VBA
Dans mon fichier joint ce trouve une feuille nommee "FORMULAIRE" qui me permet de renvoyer sur la feuille nommee "ALAIN" des heures,la formule fonctionne ,mais lorque la date du formulaire existe deja dans la feuile "Alain" je voudrait quelle la remplace
alors que la elle me la rajoute
Sub Valider()
Sheets("ALAIN").Select
Range("A4:H8359").Select
Range("A4").Select
Dim rng As Range, c As Range, ws As Worksheet, dl As Long
Application.ScreenUpdating = False
Dim nomfeuil As String
With Sheets("FORMULAIRE")
Set rng = .Range("A4:A" & .Range("A65000").End(xlUp).Row)
For Each c In rng
If c <> "" Then
On Error Resume Next
Set ws = Sheets(CStr(c))
On Error GoTo 0
If Not ws Is Nothing Then
With ws
dl = .Range("A65000").End(xlUp).Row + 1
.Range("A" & dl).Resize(1, 8).Value = c.Offset(, 1).Resize(1, 8).Value
End With
End If
Set ws = Nothing
End If
Next
End With
Application.ScreenUpdating = True
End Sub
merci pour votre aide
J'ai un souci avec une une formule VBA
Dans mon fichier joint ce trouve une feuille nommee "FORMULAIRE" qui me permet de renvoyer sur la feuille nommee "ALAIN" des heures,la formule fonctionne ,mais lorque la date du formulaire existe deja dans la feuile "Alain" je voudrait quelle la remplace
alors que la elle me la rajoute
Sub Valider()
Sheets("ALAIN").Select
Range("A4:H8359").Select
Range("A4").Select
Dim rng As Range, c As Range, ws As Worksheet, dl As Long
Application.ScreenUpdating = False
Dim nomfeuil As String
With Sheets("FORMULAIRE")
Set rng = .Range("A4:A" & .Range("A65000").End(xlUp).Row)
For Each c In rng
If c <> "" Then
On Error Resume Next
Set ws = Sheets(CStr(c))
On Error GoTo 0
If Not ws Is Nothing Then
With ws
dl = .Range("A65000").End(xlUp).Row + 1
.Range("A" & dl).Resize(1, 8).Value = c.Offset(, 1).Resize(1, 8).Value
End With
End If
Set ws = Nothing
End If
Next
End With
Application.ScreenUpdating = True
End Sub
merci pour votre aide