VBA copy cells value and format

后端 未结 4 1539
北荒
北荒 2020-12-01 14:48

How can I amend the following code in order to copy not only the value but also the fonts style, e.g. bold or not bold. Thanks

Private Sub CommandButton1_Cli         


        
4条回答
  •  眼角桃花
    2020-12-01 15:06

    This page from Microsoft's Excel VBA documentation helped me: https://docs.microsoft.com/en-us/office/vba/api/excel.xlpastetype

    It gives a bunch of options to customize how you paste. For instance, you could xlPasteAll (probably what you're looking for), or xlPasteAllUsingSourceTheme, or even xlPasteAllExceptBorders.

提交回复
热议问题