使用 vba 复制 Excel 工作表中的范围
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9570263/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Copy a range in an Excel sheet using vba
提问by Eva
In below code I just want to copy a range from one sheet, which are some subsequent cells in the same row, to some subsequent cells in the same row in another sheet,
在下面的代码中,我只想将范围从一张纸(同一行中的一些后续单元格)复制到另一张纸中同一行中的一些后续单元格,
however the code does not work as expected? What do I do wrong? K and kk are just some integers, thanks for your help
但是代码没有按预期工作?我做错了什么?K 和 kk 只是一些整数,谢谢你的帮助
Worksheets("spreadPar").Range(G & kk & ":" & Y & kk).Copy Destination:=Worksheets("EE static").Range(I & k & ":" & AA & k)
回答by assylias
Assuming kk and k contain the respective rows and G / Y, I / AA represent the columns, you probably mean (note the quotes):
假设 kk 和 k 包含各自的行,而 G / Y、I / AA 代表列,您的意思可能是(注意引号):
Worksheets("spreadPar").Range("G" & kk & ":" & "Y" & kk).Copy Destination:=Worksheets("EE static").Range("I" & k & ":" & "AA" & k)