• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Workout Instructions

JenniferS

Member
Hello,

Can there be a message popup if the file path isn't entered correctly? Then exit sub so the user can correct the file path.

"Please correct the file path"

Thank you for your help


Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

    If Not Intersect(Target, Range("G6:H29")) Is Nothing Then
        Dim PicPath As String
        PicPath = Range("PicPath").Value & "\" & Range("G" & Target.Row).Value
        Shapes("PictureArea").Fill.UserPicture PicPath
    End If
    
    If Not Application.Intersect(ActiveCell, Range("H6:H29")) Is Nothing Then
        ActiveSheet.Unprotect
        [J5].Value = Target.Offset(0, -5).Value   'Lookup value for instructions
        ActiveSheet.Protect
    End If

End Sub
 
Hello, according to VBA help insert this codeline :​
If Dir(PicPath) = "" Then MsgBox "Invalid path", 48, "Alert": Exit Sub
Do you like it ? So thanks to click on bottom right Like !​
 
Back
Top