1
votes

I have a workbook that used to be one with many sheets, I have now split the sheet to different workbooks.

The problem I now have is userform population from cell selection. When all the sheets were together. This code worked great.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Not (UFMJobSelectForm.ActiveControl Is Nothing) Then
    Call UpdateJobSelectForm
End If
End Sub

However now the Userform is in one workbook and this code is in another. I don't want to reference library as I need it to open and close so it can be accessed for other people to use.

Thanks for any help in advance.

Edit: What i have is 4 different workbooks with jobs on and i want to select the job and the userform populates with job details.

The code I have detects the userform is open and then calls then populates the userform using updatejobselectform. Which worked when all the sheets were in the same workbook. however no longer works now i have separated them.

When i run this code now the sheets are in there own work books i get Error: runtime erroe 424 object required.

So what i am asking is dose anyone know how i can check a userform is loaded from in a different workbook and how i can get the useform to interact with cell selection from a different workbook.

thanks again.

1

1 Answers

0
votes

This looks like a code that primafacie must fire when selection change event occurs, and call a function that must update the said form.

If the code and the said form are dependent, while splitting up should they not be together.

In case there are some other constraints that do not let you do so, and are not defined in the question do feel free to update the question / comment below.

Happy to help!