this should work..
Is the other workbook open? If not,
Try adding something like this (untested)
on error resume next
Dim oWB as workbook
Dim oWS as worksheet
Set oWB = Workbooks(WorkbookName) 'this is something like ABC.xlsm
on error goto 0
if owb is nothing then
Set oWB = workbooks.open(FullWorkbookPath) 'C:\WB\ABC.xlsm'
end if
if not owb is nothing then
MsgBox("No workbook was opened")
Exit sub
end if
Set oWS = owb.sheets("Sheet1")
if not ows is nothing then
aws.range("A18").value = OWB.Sheets("Sheet1").Cells("D40").value
end if
end if
owb.close
--
HTH,
Barb Reinhardt
If this post was helpful to you, please click YES below.
"pls123" wrote:
But it doesn't make the copy !!..
what's the problem??
----------------------------------------------
Dim aWB As Workbook
Dim aWS As Worksheet
Set aWB = ThisWorkbook
Set aWS = aWB.Worksheets("Sheet1")
aWS.Range("A18").Value =
("Shee t1").Cells("D40").Value
|