Got a little carried away with last post. Quick question this time.
Have an open file running a macro that goes through other open files one by one. If a file has certain criteria, I am 'activating' the file with the macro and pasting info I have in variables into it. I now want to get back to the file I got the info from so that I can close it and move on to the next file in the group. It seems as when I try and get back to the data file it gets hung up on the fact that there aren't any "Quotes" around the activation file (see below for code I've tried...)
1) Is there an easier way to 'toggle' back to the data file so that I can close it? or
2) the file name is in the file itself..can I assign that to a variable and then append it to the file name and activate it that way?
Show you what I have
Windows("Main.xls").Activate
LR = Cells(65536, 1).End(xlUp).Row
Cells(LR, 1) = "Good"
Cells(LR, 2) = Name
Windows(Name & ".XLS").Activate
Now I know the line below works, but I can't figure out how to get quotes before Name in the last line above..Assume ABCD is the Name variable above
Windows("ABCD.XLS").Activate
Have an open file running a macro that goes through other open files one by one. If a file has certain criteria, I am 'activating' the file with the macro and pasting info I have in variables into it. I now want to get back to the file I got the info from so that I can close it and move on to the next file in the group. It seems as when I try and get back to the data file it gets hung up on the fact that there aren't any "Quotes" around the activation file (see below for code I've tried...)
1) Is there an easier way to 'toggle' back to the data file so that I can close it? or
2) the file name is in the file itself..can I assign that to a variable and then append it to the file name and activate it that way?
Show you what I have
Windows("Main.xls").Activate
LR = Cells(65536, 1).End(xlUp).Row
Cells(LR, 1) = "Good"
Cells(LR, 2) = Name
Windows(Name & ".XLS").Activate
Now I know the line below works, but I can't figure out how to get quotes before Name in the last line above..Assume ABCD is the Name variable above
Windows("ABCD.XLS").Activate