Deselect Cells That Have Been Copied

  • I have a piece of coding that copies a range of cells from a worksheet to another workbook and then returns the focus to the initial worksheet. On return to that initial worksheet the range of selected cells is still selected/highlighted, even though the active cell is outside that range. How do I unselect the previously selected range of cells, to remove the rotating, dotted line from around them?

    Code
    Windows("SM_Performance.xlsm").Activate
        Range("C3:C102").Select
        Selection.Copy
        Windows("M400AD.xlsm").Activate
        Range("A3").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        Windows("SM_Performance.xlsm").Activate
        Range("K2").Select
  • Re: Deselect Cells That Have Been Copied


    Quote from pike;768882

    or

    Code
    Workbooks("SM_Performance.xlsm").Sheets("Lists").Range("A3:C102").Copy Destination:=Workbooks("M400AD.xlsm").Sheets("Sheet1").Range("A3")


    pike


    Please make me correct if I am wrong...
    This method will use xlPasteAll while OP wants to paste Values only and that cannot be specified with the destination range in the method you proposed.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!