简体   繁体   中英

copying a range from an Excel workbook to another workbook using sheet range

It looks like my code is not copying the range over, but when I tested it with a string it would copy over.

Here is my code:

    With setupSheet
        setupSheet.Range("BA1:BB7") = sheet1.Range("A2:B8")
    End With

Nothing is getting replaced in setupSheet.

The point of the with statement is so that you don't have to keep typing the expression

Try this:

  With setupSheet
    .Range("BA1:BB7") = sheet1.Range("A2:B8")
  End With

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM