sirbudan82
New Member
- Joined
- Feb 3, 2016
- Messages
- 16
I'm stuck with a simple code that I can't make it work. I have two open workbooks and I would like to activate the other workbook from the active workbook based on a cell value. The idea is to activate and close the workbook that includes the database keep the one with the output.
I'm using the code below but I'm getting an error "Subscript out of range"
Sub Switch_Workbooks()
Workbooks(ActiveSheet.Range("B20").Value).Activate
End Sub
Another code line that I could use is Windows("Name Workbook").Activate but I can't make it work to get the value of a cell
Thank you a lot
I'm using the code below but I'm getting an error "Subscript out of range"
Sub Switch_Workbooks()
Workbooks(ActiveSheet.Range("B20").Value).Activate
End Sub
Another code line that I could use is Windows("Name Workbook").Activate but I can't make it work to get the value of a cell
Thank you a lot