mayday1
Board Regular
- Joined
- Oct 5, 2007
- Messages
- 241
My macro does things to a file, File1 - a file with a different name every day. Then it looks up some data from a tab in another file and uses that data to do stuff in the first file. At least it should. The ThisWorkbook.Activate doesn't make the macro stay focused on the first file. When it does the With Workbooks line, the focus moves to that file and all the macro goodness happens in Myfile instead of File1 where it belongs. I need to understand what I should do instead of this code below.
'Misc stuff happens in File1
'put the focus on File1
ThisWorkbook.Activate
'Get some data from MyFile
With Workbooks("Myfile.xlsm").Sheets("Vols")
'After this the macro's supposed to do stuff in File1 but it's doing it in MyFile.
'Misc stuff happens in File1
'put the focus on File1
ThisWorkbook.Activate
'Get some data from MyFile
With Workbooks("Myfile.xlsm").Sheets("Vols")
'After this the macro's supposed to do stuff in File1 but it's doing it in MyFile.