Results 1 to 8 of 8

Thread: copy and paste value with condition

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #6
    VBAX Expert
    Joined
    Sep 2016
    Posts
    788
    Location
    Set RngList = CreateObject("Scripting.Dictionary")
    
    
    Do While strExtension <> ""
        Set SrcWkb = Workbooks.Open(sFolderPath & sFolderName & strExtension)
        v2 = Sheets(1).Range("C3", Sheets(1).Range("C" & Rows.Count).End(xlUp)).Value
        RngList.RemoveAll
        For i = 1 To UBound(v2, 1)
            Val = v2(i, 1)
            If Not RngList.Exists(Val) Then
                RngList.Add Key:=Val, Item:=i
            End If
        Next i
        For i = 1 To UBound(v1, 1)
            Val = v1(i, 1)
            If RngList.Exists(Val) Then
                 Sheets(1).Cells(RngList(Val) + 2, 5).Resize(, 12).Copy
                 DstWks.Cells(i + 2, 5).PasteSpecial xlPasteValues, , True
            End If
        Next i
        SrcWkb.Close False
        strExtension = Dir
    Loop
    Last edited by mana; 05-30-2020 at 06:53 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •