title: Can you use an if statement to decide what UserForm to put information in?
body: <p>I have the following issue: I have UserForm A and UserForm B in excel. Both UserForms call UserForm C. The user chooses an ID number from UserForm C that I then want to be put into a label in either UserForm A or UserForm B depending on which one is currently open. </p>
  
  <p>I have searched for a possible answer or alternative solution to this but haven't been able to find anything that helped. I am trying to avoid having to make two UserForm C's if I can help it. Any help is greatly appreciated. </p>
  
  <p>Thanks!</p>
  
  <p>Edit: Right now my code for Userform C is initiated by a click event. So, the user selects the ID number from a list box which gets saved automatically into a label that is hidden. When the user clicks the save button the hidden labels caption (the ID) gets transferred to UserForm A. What I would ultimately like is for there to be some kind of if statement to differentiate if Userform A is open and if not then the hidden labels caption would instead get transferred to UserForm B. I have thought about using an option button for the user for choose from, but not all users have access to UserForm B so I would prefer to not let the user try to determine where they should be saving the ID to. </p>
  
  <p>The code I have for the click event is:<br>
      Private Sub cmd_save_Click()<br>
      UserFormC.Label1.Caption=UserFormA.Label1.Caption<br>
      Unload UserFormC<br>
      End Sub  </p>