Excel vba 将值从一张纸更改为另一张纸
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/44392695/
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
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-12 12:41:43 来源:igfitidea点击:
Excel vba change value from one sheet to another
提问by Manish
I have two named sheets and I want to change value from one sheet to another with following syntax; however I get Type Mismatch Error. Can anyone look into this and assist me?
我有两个命名的工作表,我想使用以下语法将值从一张工作表更改为另一张工作表;但是我得到类型不匹配错误。任何人都可以调查这个并帮助我吗?
Named Sheets: wks1 and wks2
命名表:wks1 和 wks2
wks1.cells(1,1).value=wks2.cells(1,3).value
Any help would be much appreciated.
任何帮助将非常感激。
回答by Gary's Student
One example:
一个例子:
Sub Manish()
Dim wks1 As Worksheet, wks2 As Worksheet
Set wks1 = Sheets("wks1")
Set wks2 = Sheets("wks2")
wks1.Cells(1, 1).Value = wks2.Cells(1, 3).Value
End Sub