Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

faire une boucle

1 réponse
Avatar
domicol
Bonjour,
voici une macro

Sub copiedatedansarchive()


If (Sheets("archive").Range("B2").Value <> "") Then
Range("B3").Select
Selection.Copy
Range("B4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End If
End Sub
je voudrai faire une boucle qui controle une cases (jusqu'a "AAW")de la ligne 2 contiennes des informations si oui tu copié la valeur de la case (collage spésial) dans la case du dessous lcela pour chaque individuellement;
bonne journée

1 réponse

Avatar
MichD
Le 16/02/21 Í  04:11, domicol a écrit :
If (Sheets("archive").Range("B2").Value <> "") Then
Range("B3").Select
Selection.Copy
Range("B4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks
_
:ͺlse, Transpose:ͺlse
End If
End Sub

Bonjour,
Essaie comme ceci :
'----------------------------------------
Sub test()
Dim C As Range
With Application
.EnableEvents = False
.ScreenUpdating = False
End With
With Worksheets("archive")
For Each C In .Range("B2:AAW2")
If C.Value <> "" Then
C.Offset(2).Value = C.Offset(1).Value
End If
Next
End With
With Application
.EnableEvents = True
.ScreenUpdating = True
End With
End Sub
'----------------------------------------
MichD