Hi Guys,
I have a main excel file that has a indirect sumif formula linked to different protected files.
Now, I want to open and close all files at the same time so that it would pull the correct sum without turning to #REF !
If I can turn the sumif formula to hard code values it would be better.
In the meantime below is the code that opens only (I need it closed too ). File directory is in column D, PW is on Column K.
Hope you can also help me to make it more sustainable? Like if I have new files to add, I dont need to go back to the codes and add in 1 by 1. Thank you so much!
I have a main excel file that has a indirect sumif formula linked to different protected files.
Now, I want to open and close all files at the same time so that it would pull the correct sum without turning to #REF !
If I can turn the sumif formula to hard code values it would be better.
In the meantime below is the code that opens only (I need it closed too ). File directory is in column D, PW is on Column K.
Hope you can also help me to make it more sustainable? Like if I have new files to add, I dont need to go back to the codes and add in 1 by 1. Thank you so much!
HTML:
Sub open_file()
Workbooks.Open Filename:=Range("D2"), Password:=Range("K2")
Workbooks.Open Filename:=Range("D3"), Password:=Range("K3")
Workbooks.Open Filename:=Range("D4"), Password:=Range("K4")
Workbooks.Open Filename:=Range("D5"), Password:=Range("K5")
Workbooks.Open Filename:=Range("D6"), Password:=Range("K6")
Workbooks.Open Filename:=Range("D7"), Password:=Range("K7")
Workbooks.Open Filename:=Range("D8"), Password:=Range("K8")
Workbooks.Open Filename:=Range("D9"), Password:=Range("K9")
Workbooks.Open Filename:=Range("D10"), Password:=Range("K10")
Workbooks.Open Filename:=Range("D11"), Password:=Range("K11")
Workbooks.Open Filename:=Range("D12"), Password:=Range("K12")
Workbooks.Open Filename:=Range("D13"), Password:=Range("K13")
Workbooks.Open Filename:=Range("D14"), Password:=Range("K14")
End Sub