如果没有图片匹配,然后显示消息框

我有下面的代码完美的作品感谢您的家伙的帮助,但我有一个代码林不知道该怎么做。 对于“获得一个匹配:从VAST文件夹获取图片样本 – 如果找不到匹配,我想显示一个msg框。 这可能没有太多的切换我的代码?

Private Sub RejectTitleNm_Change() Dim f As Range, v v = Me.RejectTitleNm.Value ' find the selected value in the source range from ColB(RejectTitle) Set f = Range("RejectTitle").Find(v, lookat:=xlWhole) Me.TextBox1.Text = "" If Not f Is Nothing Then ' got a match: get value from ColC(Issue) on same row Me.TextBox1.Text = f.EntireRow.Cells(, "C").Value ' got a match: get value from ColD(TA) on same row Me.TextBox2.Text = f.EntireRow.Cells(, "D").Value ' got a match: get value from ColE(VBA) on same row Me.TextBox3.Text = f.EntireRow.Cells(, "E").Value ' REJECT ID ' got a match: get value from ColA(RejectID) on same row Me.RejectID.Text = f.EntireRow.Cells(, "A").Value ' CHANNELS ' got a match: get value from ColF(Mail) on same row Me.MailChannel.Text = f.EntireRow.Cells(, "F").Value ' got a match: get value from ColG(Web) on same row Me.WebChannel.Text = f.EntireRow.Cells(, "G").Value ' got a match: get value from ColG(Phone) on same row Me.PhoneChannel.Text = f.EntireRow.Cells(, "H").Value ' got a match: get sample of pic from reject folder RejectSamples.Image2.Picture = LoadPicture(ThisWorkbook.Path & "\RejectExamples\" & RejectTitleNm.Value & ".jpg") ' got a match: get sample of pic from VAST folder Vexamples.VASTEx.Picture = LoadPicture(ThisWorkbook.Path & "\VASTScreens\" & RejectTitleNm.Value & ".jpg") End If End Sub 

 Private Sub RejectTitleNm_Change() Dim f As Range, v v = Me.RejectTitleNm.Value ' search value Set f = Range("RejectTitle").Find(v, lookat:=xlWhole) ' search RejectTitle (column B) Me.TextBox1.Text = "" If Not f Is Nothing Then ' update userForm from data in same row Me.TextBox1.Text = f.EntireRow.Cells(, "C").Value ' Issue (column C in "found" row) Me.TextBox2.Text = f.EntireRow.Cells(, "D").Value ' TA Me.TextBox3.Text = f.EntireRow.Cells(, "E").Value ' VBA Me.RejectID.Text = f.EntireRow.Cells(, "A").Value ' RejectID ' CHANNELS Me.MailChannel.Text = f.EntireRow.Cells(, "F").Value ' Mail Me.WebChannel.Text = f.EntireRow.Cells(, "G").Value ' Web Me.PhoneChannel.Text = f.EntireRow.Cells(, "H").Value ' Phone ' get sample of pic from reject folder RejectSamples.Image2.Picture = LoadPicture(ThisWorkbook.Path & "\RejectExamples\" & RejectTitleNm.Value & ".jpg") ' get sample of pic from VAST folder Vexamples.VASTEx.Picture = LoadPicture(ThisWorkbook.Path & "\VASTScreens\" & RejectTitleNm.Value & ".jpg") Else MsgBox "please check your input", vbExclamation, "No match found" End If End Sub