Excel Form

Student1000

Board Regular
Joined
Jul 17, 2007
Messages
58
I created a form(UserForm1) in excel. I would like it to come up everytime a user open the workbook.
Second, the form will have check boxes which will populate a column when checked. I was able to do that without using a form with the following code:

Private Sub CheckBox1_Click()
If CheckBox1 = True Then

Dim NextCell As Range
'Set NextCell to last unavailable cell beyond D4 (next cell is available)
Set NextCell = Sheet1.Range("B41").End(xlDown)
'Quit if no place to put value (next available cell is beyond row 20)
If NextCell.Row < 32000 And NextCell.Row > 71 Then Exit Sub
If NextCell.Row > 32000 Then Set NextCell = Range("B41")

NextCell.Offset(1).Value = "Thank you for choosing our services...."
End If
End Sub

I dont know what i need to change to make this work on a checkbox thats on a form

Thanks.
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
come up everytime a user open the workbook.
Code:
'- in ThisWorkbook module
Private Sub Workbook_Open()
    UserForm1.Show
End Sub

work on a checkbox thats on a form

The userform uses the same event.
Doubleclick the checkbox on the form, or type to get it.
 
Upvote 0
That seem to work but am afraid i inserted it in a wrong place (how do u put it on the worksheet module?, it didnt work when i put it with checkboxes...) hope that make sense!!

Private Sub Workbook_Open()
UserForm1.Show
End Sub

I got the chekboxes and everything to work. However, i find that when the form has focus i can not scroll up/down the page nor can i minimize the form, so i have close(X) it.
When i bring it up it does not recall my selections(checkboxes), so i have to check the boxes again :(
I would put the code above on the worksheet module as instructed, but i dont know how to get there...... :oops:

Thanks
 
Upvote 0
In the VBA editor,
In the Project Explorer panel, (Ctrl-R will open if needed)
You will see any Sheetnames and Modules in a Tree view.
At the bottom of the sheetname list, (shown as Microsoft Excel Objects), is an object called "Thisworkbook"
Double click "thisworkbook" to activate that module

-or-

Right Click the Excel Icon in the upper left of your worksheet, (left of the File drop-down menu).
Click "View Code"
 
Upvote 0

Forum statistics

Threads
1,213,558
Messages
6,114,296
Members
448,564
Latest member
ED38

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top