Excel VBA Run-time error '13' Type mismatch -
i trying copy values 1 work book current work book error:
run-time error '13' type mismatch
i tried lot not solution 1 please me out
sub update() dim spath string dim svalue string dim wbtarget workbook dim strname string strname = activesheet.name ' explicitly provide sheet name spath = "c:\users\nikhil.surendran\desktop\1" set wbtarget = workbooks.open("c:\users\nikhil.surendran\desktop\3" & ".xlsx") svalue = wbtarget.sheets(1).range("a1:b5").value thisworkbook.sheets(1).range("a1:b5").value = svalue thisworkbook.save end sub
wbtarget.sheets(1).range("a1:b5").value
returns array of variant
s. cannot store in string
. declare svalue
variant
or variant()
.
Comments
Post a Comment