luis0antonio5
New Member
- Joined
- Jul 30, 2022
- Messages
- 1
- Office Version
- 365
- 2021
- 2019
- Platform
- Windows
Hi, i have a lot of lines a code, there are ranges of some cells. Each one save a position of others books by reference.
The year, cmbMes, txtDia there are form objects. To complete the path string values.
when it doesn't find the file it breaks the code and shows a file browser window asking to add the file it didn't find, this becomes a loop since I have many lines of code like the ones I put here, so if it doesn't find the file the code does not stop.
And i need to press cancel like 100 times to finish it (because I have 100 lines of code like the ones I inserted above)
So I want a way that if it doesn't find the file in the first line, it doesn't search because if it doesn't find it in the first lines, it won't find it in the others.
VBA Code:
Sheets("test").Range("b3").Value = "='\\server1\DATA\dataset\cabinetes\L31\time\" & year1 & "\" & cmbMes.Value & "\LAST" & "\[L" & "31" & "_" & txtDia.Value & ".xlsx]2do'!R9C6"
Sheets("test").Range("b4").Value = "='\\server1\DATA\dataset\cabinetes\L31\time\" & year1 & "\" & cmbMes.Value & "\LAST" & "\[L" & "31" & "_" & txtDia.Value & ".xlsx]2do'!R10C6"
Sheets("test").Range("b5").Value = "='\\server1\DATA\dataset\cabinetes\L31\time\" & year1 & "\" & cmbMes.Value & "\LAST" & "\[L" & "31" & "_" & txtDia.Value & ".xlsx]2do'!R11C6"
..........
......
....
.
.
.
when it doesn't find the file it breaks the code and shows a file browser window asking to add the file it didn't find, this becomes a loop since I have many lines of code like the ones I put here, so if it doesn't find the file the code does not stop.
And i need to press cancel like 100 times to finish it (because I have 100 lines of code like the ones I inserted above)
So I want a way that if it doesn't find the file in the first line, it doesn't search because if it doesn't find it in the first lines, it won't find it in the others.