Hi everyone,

I have few questions about workbook and worksheet properties.
I have working with several workbooks and worksheets.
Here is an extract of my code (which works):

Sub xlsfiles_update()



Set wbDD=Workbooks.Open(sFile1)
Set wbOO=Workbooks.Open(sFile2)
Set wb=Workbooks(sFile3)


Set wsDD=wbDD.Worksheets("Sheet1")
Set wsOO=wbOO.Worksheets("Sheet1")
Set ws1=wb.Worksheets("Shee1")
Set ws2=wb.Worksheets("Sheet2")
Set wsCAL=wb.Worksheets("Sheet3")






LastRowDD=wsDD.Cells(rows.count,2).End(xlUp).Row
LastRowOO=wsOO.Cells(rows.Count,2).End(xlUp).Row


wbDD.Activate
ValDD=wsDD.Range(Cells(2,1),Cells(LastRowDD,88)).Value


wbOO.Activate
ValOO=wsOO.Range(Cells(2,1),Cells(LastRowOO,23)).Value


ws1.Activate
ws1.Range(Cells(2,1),Cells(LastRowOO,23)).Value=ValOO
ws2.Activate
ws2.Range(Cells(2,1),Cells(LastRowDD,88)).Value=ValDD




wsCAL.Activate


End Sub
On the last lines, you can notice that I've activated the worksheet before transferring the values.
But I don't understand why it is necessary (if I remove ws1.Activate it doesn't work) to do it whereas I set up my variable as follows: wb.Worksheets("...")

To me, I am referencing twice the workbook but the Macro disagrees... Could you explain?

Thanks a lot in advance.