Hello all,
I have problem with VBA macro in excel. I see error 13 type mismatch, after try to import data to excel sheet.
First macro import data from several files from the specified folder (*.xls excel files), but it stop with error at: "If Target.Column = 1 And Target.Row > 1 And Target <> "" Then"
I have problem with VBA macro in excel. I see error 13 type mismatch, after try to import data to excel sheet.
First macro import data from several files from the specified folder (*.xls excel files), but it stop with error at: "If Target.Column = 1 And Target.Row > 1 And Target <> "" Then"
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 And Target.Row > 1 And Target <> "" Then
Application.EnableEvents = False
If Right(Target, 1) <> "\" Then Target = Target & "\"
On Error GoTo e
If Dir(Target, vbDirectory) = "" Then
Target.Font.Color = vbRed
MsgBox "Wrong path, correct.", vbCritical, "Attention"
Target.Select
Else
Target.Font.Color = vbBlue
End If
Application.EnableEvents = True
End If
Exit Sub
e:
If Err = 52 Then
Target.Font.Color = vbRed
MsgBox "Wrong path, correct.", vbCritical, "Attention"
Target.Select
End If
End Sub