I have a userform that the user will input the file location of the excel file to open.
How do I open that file, and activate Sheet1 of that file. I will not know that exact name of the first sheet in the newly opened excel workbook so I have to use the Sheet1.
I have the code:
Application.Workbooks.Open xlxlocation.Text
Sheets(Sheet1).Activate
But it errors about because there are two Sheet1. (one from the excel file with the userform program and one from the newly opened excel file. How do it tell it to activate the sheet1 from the xlxlocation.text location.
xlxlocation.text = full file name (C:/ahldfl/asldjfd/workbook.xls)
I know it is something simple but I cannot figure it out. I think you may have to use "With" but i am just beginning.
How do I open that file, and activate Sheet1 of that file. I will not know that exact name of the first sheet in the newly opened excel workbook so I have to use the Sheet1.
I have the code:
Application.Workbooks.Open xlxlocation.Text
Sheets(Sheet1).Activate
But it errors about because there are two Sheet1. (one from the excel file with the userform program and one from the newly opened excel file. How do it tell it to activate the sheet1 from the xlxlocation.text location.
xlxlocation.text = full file name (C:/ahldfl/asldjfd/workbook.xls)
I know it is something simple but I cannot figure it out. I think you may have to use "With" but i am just beginning.
Last edited: