简体   繁体   中英

VBA Macros for Excel

I am trying to execute a program in which the program gets the data from a workbook to a different workbook, but I get a runtime-9-error . Please Help me.

Sub cutex3()
    'between 2 sheets in two different workbooks
    Workbooks("book2").Sheets("sheet2").Range("A1 : A5").Cut _
    Workbooks("book3").Sheets("sheet3").Range("A1 : A5")
End Sub

but i get a runtime-9-error

The code that you gave above works for me but since you are getting Run-time error 9 that means it's a Subscript out of range Error.

Please ensure that you have the following

  1. Workbook named book2

  2. Workbook named book3

  3. Worksheet named sheet2 in book2

  4. Worksheet named sheet3 in book3

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