Hi all,

I have my macro almost working, but the last part I don't know how to fix, I hope some one can help me to solev my question.

What I have is a data sheet (Workbook A) with all data, when I double click in column B on cell a other Unserform in workbook B get opend en de data of the cell in column B popultate the textbox in the userform.
But now my question, when I double click on the cell column B, I like to use the cell data of column P of the same row to select a optionbutton in the userform of the other workbook.

when column p contains (workbook A)

"Hello" = select optionbutton 1 of the userform workbook B
"Good" = select optionbutton 2 of the userform workbook B
"cheers" = select optionbutton 3 of the userform workbook B

Does some one know how to fix this last part?

My code of workbook A:

Public PreviousActiveCell As Range

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Static pPrevious As Range
    Set PreviousActiveCell = pPrevious
    Set pPrevious = ActiveCell
End Sub

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
  If Not Application.Intersect(Target, Range("B9:B99999")) Is Nothing Then
  
          Dim WB As Workbook

            On Error Resume Next 'controleer of het aanvraag formulier geopend is
            Set WB = Workbooks("test.xlsm")

            If Err <> 0 Then 'zoniet op het formulier
            On Error GoTo 0
        Workbooks.Open Filename:=ThisWorkbook.Path & "\test.xlsm"
        
    End If

    Application.Run "'test.xlsm'!Zoeken" 'run macro
    
  End If
End Sub
My code of workbook B

Private Sub UserForm_Activate()
    Dim r As Long
    
    r = ActiveCell.Row
    txtNummer = Cells(r, 2)
 
End Sub