VBA做Vlookup然后vbyesno框

我写了一个VBA,做一个Vlookup。 它查找索赔号码,每个caim有一个超链接在范围的第3列,导致索赔的细节,图片等。Vlookup返回第3列相关的超链接罚款,但是我想要一个vbyesno框给予用户可以将选项定向到Vlookup返回的超链接并查看声明详细信息。 我已经设法得到它的工作好的引导人们到一个url(我曾用谷歌在我的VBA作为例子)是否有可能稍微改变我的VBA所以而不是谷歌它将改变超链接取决于结果的VLOOKUP。

这是我写的VBA

Sub check() On Error GoTo MyerrorHandler: Dim claim_number As String Dim here As String claim_number = InputBox("please enter claim number") If Len(claim_number) > 0 Then Set myRange = Range("claims") Set objShell = CreateObject("Wscript.Shell") here = Application.WorksheetFunction.VLookup(claim_number, myRange, 3, False) intMessage = MsgBox("The claim has been partly investigated by Ali. Would" "you like to view the details of the claim.", _ vbYesNo, "Great news Lee") If intMessage = vbYes Then objShell.Run ("www.google.com") Else Wscript.Quit End If Else MsgBox "You didn't enter a claim number" End If Exit Sub MyerrorHandler: If Err.Number = 1004 Then MsgBox "Claim has not been invsetigated" End If End Sub 

谢谢你们的帮助 我已经设法解决这个问题。 我只是用ThisWorkbook.FollowHyperlink(这里)

如下所示

 Sub check() On Error GoTo MyerrorHandler Dim claim_number As String Dim here As String claim_number = InputBox("Please enter the claim number") If Len(claim_number) > 0 Then Set myrange = Range("claims") Set objShell = CreateObject("Wscript.Shell") here = Application.WorksheetFunction.VLookup(claim_number, myrange, 3, False) intMessage = MsgBox("This claim has been investigated by Ali. Would you like to view the details?", _ vbYesNo, "GREAT NEWS LEE") If intMessage = vbYes Then ThisWorkbook.FollowHyperlink (here) Else Wscript.Quit End If Else MsgBox "You didn't enter a claim number" End If Exit Sub MyerrorHandler: If Err.Number = 1004 Then MsgBox "This claim has not been investigated" End If 

结束小组