Hello,
I try to write this macro which could enable me to open files according to cells value I chose previously in my active workbook (In "Inputs" sheet to be accurate). These files I want to open are closed and under other folders.
Here is my code but I have this message poping up "Type Mismatch, Error '13':
I am just discovering VBA... Can somebody try to solve this problem please ?
Thanks a lot !
Here is my code:
I try to write this macro which could enable me to open files according to cells value I chose previously in my active workbook (In "Inputs" sheet to be accurate). These files I want to open are closed and under other folders.
Here is my code but I have this message poping up "Type Mismatch, Error '13':
I am just discovering VBA... Can somebody try to solve this problem please ?
Thanks a lot !
Here is my code:
Code:
Sub ImportFile()
Dim A As String
Dim B As String
Dim C As String
If Sheets("Inputs").Range("A_A1") > Sheets("Inputs").Range("G6") Then
A= Sheets("Inputs").Range("A_A1") & "_12"
Else: Sheets("Inputs").Range("A_A1") = Sheets("Inputs").Range("G6")
If Sheets("Inputs").Range("M3") < 10 Then
A = Sheets("Inputs").Range("A_A1") & "_0" & Sheets("Inputs").Range("M3")
Else
If Sheets("Inputs").Range("M3") >= 10 Then
A = Sheets("Inputs").Range("A_A1") & "_" & Sheets("Inputs").Range("M3")
End If
End If
If Sheets("Inputs").Range("B_B1") = "BLUE Then
B = "BLUE"
Else
B = "RED"
C = Range("C_C1") & " - " & A
End If
End If
Workbooks.Open Filename:="S:\XXXX\ZZZZ\& A & " \ " & B & " \ " & C & *.xls"
End Sub
Last edited: