View Single Post
 
Old 05-09-2017, 08:32 PM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,137
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

It sounds like there is no value in strResult when changed to use the userform value. Greg has shown how to use a userform value. He has not included the userform, which you will need to add to your document or modify the code to use the value selected from the userform. Userforms are difficult to reproduce in the forum.

Replace the Macro1 I provided earlier with
Code:
Sub Macro1()
'look for the value in the first column and return the value in the sixth column
Dim strResult As String
Dim strValue As String
    strValue = InputBox("Enter the value to find")
    If strValue = "" Then
        MsgBox "No value entered or user cancelled"
        GoTo lbl_Exit
    End If
    strResult = GetValue(strValue, 6)
    FillBM "bookmarkname", strResult    'fill the named bookmark with the value
lbl_Exit:
    Exit Sub
End Sub
which does not need a userform.
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote