fast way to copy formatting in excel

前端 未结 5 1811
忘了有多久
忘了有多久 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条回答
  •  萌比男神i
    2020-12-05 20:18

    Just use the NumberFormat property after the Value property: In this example the Ranges are defined using variables called ColLetter and SheetRow and this comes from a for-next loop using the integer i, but they might be ordinary defined ranges of course.

    TransferSheet.Range(ColLetter & SheetRow).Value = Range(ColLetter & i).Value TransferSheet.Range(ColLetter & SheetRow).NumberFormat = Range(ColLetter & i).NumberFormat

提交回复
热议问题