willow1985
Well-known Member
- Joined
- Jul 24, 2019
- Messages
- 888
- Office Version
- 365
- Platform
- Windows
I have a spreadsheet that contains a macro that when run opens various other spreadsheets, grabs their data and closes them. However this main spreadsheet is accessed by multiple users in 2 different ways on a network. Sometimes the drive can appear as X and other times as an address like 190.165.1.22\
Basically what I am looking for is if the macro runs into an error where it cannot find the drive (I am assuming this is the problem because I am getting a Subscript out of range Error) that it will try the 2nd directory (see VBA code)
Any help would be greatly appreciated!
Basically what I am looking for is if the macro runs into an error where it cannot find the drive (I am assuming this is the problem because I am getting a Subscript out of range Error) that it will try the 2nd directory (see VBA code)
Any help would be greatly appreciated!
VBA Code:
Dim CAPAD As String
Dim CCD As String
Dim CID As String
Dim NCRD As String
Dim ASD As String
Dim CAPAN As String
Dim CCN As String
Dim CIN As String
Dim NCRN As String
Dim ASN As String
CAPAD = Workbooks("Quality Dashboard").Sheets("Graph Data").Range("B15").Value ‘ or Workbooks("Quality Dashboard").Sheets("Graph Data").Range("B22").Value
CCD = Workbooks("Quality Dashboard").Sheets("Graph Data").Range("B16").Value ‘or Workbooks("Quality Dashboard").Sheets("Graph Data").Range("B23").Value
CID = Workbooks("Quality Dashboard").Sheets("Graph Data").Range("B17").Value ‘or Workbooks("Quality Dashboard").Sheets("Graph Data").Range("B24").Value
NCRD = Workbooks("Quality Dashboard").Sheets("Graph Data").Range("B18").Value ‘or Workbooks("Quality Dashboard").Sheets("Graph Data").Range("B25").Value
ASD = Workbooks("Quality Dashboard").Sheets("Graph Data").Range("B19").Value ‘or Workbooks("Quality Dashboard").Sheets("Graph Data").Range("B26").Value
CAPAN = Workbooks("Quality Dashboard").Sheets("Graph Data").Range("B29").Value
CCN = Workbooks("Quality Dashboard").Sheets("Graph Data").Range("B30").Value
CIN = Workbooks("Quality Dashboard").Sheets("Graph Data").Range("B31").Value
NCRN = Workbooks("Quality Dashboard").Sheets("Graph Data").Range("B32").Value
ASN = Workbooks("Quality Dashboard").Sheets("Graph Data").Range("B33").Value
Cell Formulas | ||
---|---|---|
Range | Formula | |
B15 | B15 | ="\\190.165.1.22\cad\QUALITY\Group\Corrective Actions\CAPA findings\"&B29 |
B16 | B16 | ="\\190.165.1.22\cad\QUALITY\Group\Corrective Actions\Customer Concerns - Corrective Action\"&B30 |
B17 | B17 | ="\\190.165.1.22\com\Lean Folder\"&B31 |
B18 | B18 | ="\\190.165.1.22\cad\QUALITY\Group\Supplier Non-Conformance Reports\"&B32 |
B19 | B19 | ="\\190.165.1.22\cad\QUALITY\Group\Audit\"&B33 |
B22 | B22 | ="X:\QUALITY\Group\Corrective Actions\CAPA findings\"&B29 |
B23 | B23 | ="X:\QUALITY\Group\Corrective Actions\Customer Concerns - Corrective Action\"&B30 |
B24 | B24 | ="S:\Lean Folder\"&B31 |
B25 | B25 | ="X:\QUALITY\Group\Supplier Non-Conformance Reports\"&B32 |
B26 | B26 | ="X:\QUALITY\Group\Audit\"&B33 |