Userform that will work on macs and pcs

pwebley

Board Regular
Joined
Mar 2, 2011
Messages
69
Right now I have a userform that opens as soon as the workbook is opened. It prompts for the user to put their name then it dumps it into a cell in the spreadsheet. If the contents of the cell are removed the userform reappears. This works great on pcs but it doesn't work on macs! Here is what I have:

Private Sub CommandButton1_Click()
If TextBox1.Value = "" Then
MsgBox "Please enter your name in the text field"
Me.TextBox1.SetFocus
Else
Range("C2").Value = UserForm1.TextBox1.Text
UserForm1.Hide
End If
End Sub
Private Sub UserForm_QueryClose _
(Cancel As Integer, CloseMode As Integer)
' Prevents use of the Close button
If CloseMode = vbFormControlMenu Then
MsgBox "Please enter your name in the text field"
Cancel = True
End If
End Sub

Again this runs when the workbook is opened:

Private Sub Workbook_Open()
UserForm1.TextBox1.SetFocus
UserForm1.Show
End Sub

When the cell is emptied it reappears:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address <> "$C$2" Then Exit Sub
If Target.Value = "" Then
UserForm1.Show
End If
End Sub

This works great with pcs but how do I get it to work with macs?! Any help will be appreciated.
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Forum statistics

Threads
1,224,567
Messages
6,179,571
Members
452,927
Latest member
whitfieldcraig

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