Thanks for reaching out!
Here are some steps below
- Store the Selected Row: Before you open File B, save the selected row index or the data from that row to a variable or a global variable. You can do this in the button click event that triggers the UserForm.
Assuming selectedRow will be assigned the row number of the selected row selectedRow = ActiveCell.RowDim selectedRow As Long - Open File B: After storing the selected row, you can open File B. You might want to use
Workbooks.Opento do this. Workbooks.Open "Path\to\FileB.xlsm" - Return to File A: When you're done with File B, make sure to return to File A using
Workbooks("FileA.xlsm").Activate. - Repopulate the UserForm: Use the stored row index to select the corresponding data and load it into the UserForm as needed when reopening it.
- Show the UserForm Again: Finally, use the
.Showmethod to display the UserForm again as needed.