Checkbox VBA code works on PC but not on Mac

Monsignor

Board Regular
Joined
May 30, 2011
Messages
162
This code is working fine on my PC. On my Mac I get an error saying that the activity is not available for the object, and this portion is highlighted yellow:


Code:
 If wsUF.Shapes("Check Box 1").ControlFormat.Value = xlOn


Here is the full routine. In summary:
On "User Form" there are 10 options that a person might be interested in. On "Report" I want to unhide the rows connected to the options chosen on "User Form."

Code:
Sub makereport()'
' unhiderowonreport Macro
'
' Keyboard Shortcut: Ctrl+Shift+U


Dim wsUF As Worksheet
Set wsUF = Worksheets("User Form")


'
Sheets("Report").Select


    If wsUF.Shapes("Check Box 1").ControlFormat.Value = xlOn Then Sheets("Report").Select Rows("15").Select
    Selection.EntireRow.Hidden = False
        
    If wsUF.Shapes("Check Box 2").ControlFormat.Value = xlOn Then Rows("16").Select
        Selection.EntireRow.Hidden = False
        
    If wsUF.Shapes("Check Box 3").ControlFormat.Value = xlOn Then Rows("20").Select
        Selection.EntireRow.Hidden = False
        
    If wsUF.Shapes("Check Box 4").ControlFormat.Value = xlOn Then Rows("19").Select
        Selection.EntireRow.Hidden = False
    
    If wsUF.Shapes("Check Box 5").ControlFormat.Value = xlOn Then Rows("18").Select
        Selection.EntireRow.Hidden = False
        
    If wsUF.Shapes("Check Box 6").ControlFormat.Value = xlOn Then Rows("17").Select
        Selection.EntireRow.Hidden = False
    
     If wsUF.Shapes("Check Box 7").ControlFormat.Value = xlOn Then Rows("21").Select
        Selection.EntireRow.Hidden = False
    If wsUF.Shapes("Check Box 12").ControlFormat.Value = xlOn Then Rows("22").Select
        Selection.EntireRow.Hidden = False
    If wsUF.Shapes("Check Box 11").ControlFormat.Value = xlOn Then Rows("23").Select
        Selection.EntireRow.Hidden = False
    If wsUF.Shapes("Check Box 13").ControlFormat.Value = xlOn Then Rows("24").Select
        Selection.EntireRow.Hidden = False
    
    
    Range("C1").Select
    
    MsgBox ("Report Complete")




End Sub
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
The syntax seems fine to me (works on my Mac). Can you provide a sample file somewhere (skydrive, dropbox etc) for testing?
 
Upvote 0
That is odd-seems you need to change the declaration to:
Code:
Dim wsUF As Object
for some reason!
 
Upvote 0
Yes, it should work on both. No idea why it's necessary on the Mac though - maybe there's a difference in the way they built the compiler.
 
Upvote 0
Based on the code test I had run successfully earlier, I substituted the variable in your code with a direct reference to worksheets("user form") and that worked, so I tested changing the variable declaration.
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,855
Members
452,361
Latest member
d3ad3y3

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