简体   繁体   中英

Excel vba change value from one sheet to another

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.cells(1,1).value=wks2.cells(1,3).value

Any help would be much appreciated.

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

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