vba code to activate open workbook

Hi,

i have 2 files in the below mentioned cells, and i have given below code to open, i want activate file1, i have given below code its not working.
Could anyone please suggest
File1 = Sheet1.Cells(7, 3).Value
File2 = Sheet1.Cells(12, 3).Value

Workbooks.Open Filename:=File1
Workbooks.Open Filename:=File2

workbooks("file1").activate

Thank you in advance.
rdy123 rdyAsked:
Who is Participating?
 
NorieVBA ExpertCommented:
If you change the order the workbooks are opened in then you can have file1 be the active workbook.
Workbooks.Open Filename:=File2
Workbooks.Open Filename:=File1

Open in new window

Or you could try this.
File1 = Sheet1.Cells(7, 3).Value
File2 = Sheet1.Cells(12, 3).Value

Set wb1 = Workbooks.Open(Filename:=File1)
Set wb2 = Workbooks.Open(Filename:=File2)

wb1.Activate

Open in new window

0
 
rdy123 rdyAuthor Commented:
It's working, thank you so much
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.