Paste Special

Bonjour

Dans la macro suivante

je souhaiterais faire un coller "PasteSpecial"

je ne trouve pas la bonne formulation

Merci de m'aider

Pierre_br

Sub copy_tabl1()

Application.ScreenUpdating = False

Dim Valeur As Long

With Sheets("pre_tab")

Valeur = .Range("m" & Rows.Count).End(xlUp).Row

For i = 1 To Valeur

If .Range("b" & i) < 128 And Range("b" & i) > 0 Then

.Range("c" & i).copy .Range("d" & .Range("a" & i)) .PasteSpecial Paste:=xlPasteValues

.Range("c" & i).copy .Range("e" & .Range("b" & i))

End If

Next i

End With

Application.ScreenUpdating = True

End Sub

Bonjour,

à tester,

.Range("d" & .Range("a" & i)).Value = .Range("c" & i).Value

Salut pierre_br,

puisque tu ne veux que les valeurs, tu peux passer celles-ci directement sans COPY : plus facile, plus rapide!

        .Range("d" & .Range("a" & i).Value).Value = .Range("c" & i).Value
        .Range("e" & .Range("b" & i).Value).Value = .Range("c" & i).Value

A+

Bonjour à toutes et à tous,

Et une autre proposition...

Sub copy_tabl1()
Dim ws As Worksheet
Dim lCounter As Long, rw As Long, lValue As Long
    Set ws = Worksheets("pre_tab")
    With ws
        lCounter = .Cells(.Rows.Count, 13).End(xlUp).Row
        For rw = 1 To lCounter
            lValue = .Cells(rw, 2).Value
            If lValue > 0 And lValue < 128 Then
                .Cells(.Cells(rw, 1).Value, 4).Value = .Cells(rw, 3).Value
                .Cells(lValue, 5).Value = .Cells(rw, 3).Value
            End If
        Next rw
    End With
End Sub

[quote=curulis57 post_id=731341 time=1549114133 user_id=38244]

Salut pierre_br,

puisque tu ne veux que les valeurs, tu peux passer celles-ci directement sans COPY : plus facile, plus rapide!

 .Range("d" & .Range("a" & i).Value).Value = .Range("c" & i).Value
        .Range("e" & .Range("b" & i).Value).Value = .Range("c" & i).Value

Re bjr

Ce que tu me proposes fonctionne trés bien

mais pour moi ça se complique sur la macro suivante

où je souhaite toujours copier les valeurs.

As tu une solution ?

Pierre

Sub copy_tabl1bis()

Application.ScreenUpdating = False

Dim Valeur As Long

With Sheets("pre_tab")

Valeur = .Range("m" & Rows.Count).End(xlUp).Row

For i = 1 To Valeur

stps = 5

If .Range("d" & i) < 104 And Range("d" & i) > 0 Then

.Range("h" & i).copy Destination:=Sheets("64_4t").Range("c" & .Range("d" & i).Value + stps)

.Range("f" & i).copy Destination:=Sheets("64_4t").Range("d" & .Range("d" & i).Value + stps)

.Range("g" & i).copy Destination:=Sheets("64_4t").Range("f" & .Range("d" & i).Value + stps)

Next i

End With

Application.ScreenUpdating = True

End Sub]

re,

c'est le même principe,

Sheets("64_4t").Range("c" & .Range("d" & i).Value + stps).Value = .Range("h" & i).Value
Sheets("64_4t").Range("d" & .Range("d" & i).Value + stps).Value = .Range("f" & i).Value
Sheets("64_4t").Range("f" & .Range("d" & i).Value + stps).Value = .Range("g" & i).Value

Merci pour votre aide

Cela me fait gagner du temps et beaucoup de précision.

Bon Week end

Rechercher des sujets similaires à "paste special"