I have been processing my spreadsheets manually for at least 6 years because I did not take the time to learn how to make a macro do the work for me. Now I am getting into it and am having a measure of success. In one of the steps I use a VLOOKUP function to populate in columns C and D from a table in SortLookup.xlsx, based on the Item ID in column B. Inexplicably, sometimes the function works without opening SortLookup.xlsx and somtimes it does not. However, it always works if I have SortLookup.xlsx open.
To be safe in my macro I want to open SortLookup.xlsx, then proceed with my macro. Here is the part of my code giving me trouble.
Dim curWorkbook As Workbook
Set curWorkbook = ActiveWorkbook
Workbooks.Open Filename:="SortLookup.xlsx"
curWorkbook.Activate
The last line activates Personal.xlsb rather than the worksheet I was working on. What am I doing wrong?
To be safe in my macro I want to open SortLookup.xlsx, then proceed with my macro. Here is the part of my code giving me trouble.
Dim curWorkbook As Workbook
Set curWorkbook = ActiveWorkbook
Workbooks.Open Filename:="SortLookup.xlsx"
curWorkbook.Activate
The last line activates Personal.xlsb rather than the worksheet I was working on. What am I doing wrong?