What is a modeless UserForm and how to create it automatically using a macro. Watch the video below:
UserForms have a property called ShowModal. The image below shows the default setting for the ShowModal property:
The ShowModal property can be changed to False and the UserForm becomes modeless. This means that the user can access the worksheet cells, Ribbon, etc. even while the UserForm is open.
We can automate the process of making the UserForm modeless quickly and easily by using the following codes:
We can also attach the module ShowUserForm to a form button on the worksheet as shown in the training video.
The code for the ‘Transfer Data’ button is also given below:
Private Sub CommandButton1_Click()
Dim LastRow As Long
LastRow = Application.WorksheetFunction.CountA(Sheet1.Range(“A:A”))
Range(“A” & LastRow).Offset(1, 0) = TextBox1.Text
Range(“B” & LastRow).Offset(1, 0) = TextBox2.Text