Hello,
I have just created with VBA a new Excel file (A) that I will develop further (i.e. run more VBA on it).
I also have a source Excel file (B) in which I have source data to run VBA scripts.
So it is important to specify from which of both Excel files I read data (A or B) or write in (only A) in my VBA.
I try the following VBA but this is giving me an error message (error 9: suscript out of range), probably because it is unclear from which file to search the data.
[source]
DataSourceFile = Range("LastFileEdited")
Set W2bk = Workbooks (DataSourceFile) 'error 9: suscript out of range
Workbooks(W2bk).Open
[/source]
Can you please indicate how I should correctly write this VBA?
Thank you for your help.
I have just created with VBA a new Excel file (A) that I will develop further (i.e. run more VBA on it).
I also have a source Excel file (B) in which I have source data to run VBA scripts.
So it is important to specify from which of both Excel files I read data (A or B) or write in (only A) in my VBA.
I try the following VBA but this is giving me an error message (error 9: suscript out of range), probably because it is unclear from which file to search the data.
[source]
DataSourceFile = Range("LastFileEdited")
Set W2bk = Workbooks (DataSourceFile) 'error 9: suscript out of range
Workbooks(W2bk).Open
[/source]
Can you please indicate how I should correctly write this VBA?
Thank you for your help.