fast way to copy formatting in excel

前端 未结 5 1809
忘了有多久
忘了有多久 2020-12-05 19:43

I have two bits of code. First a standard copy paste from cell A to cell B

Sheets(sheet_).Cells(x, 1).Copy Destination:=Sheets(\"Output\").Cells(startrow, 2)         


        
5条回答
  •  抹茶落季
    2020-12-05 20:36

    For me, you can't. But if that suits your needs, you could have speed and formatting by copying the whole range at once, instead of looping:

    range("B2:B5002").Copy Destination:=Sheets("Output").Cells(startrow, 2)
    

    And, by the way, you can build a custom range string, like Range("B2:B4, B6, B11:B18")


    edit: if your source is "sparse", can't you just format the destination at once when the copy is finished ?

提交回复
热议问题