Reference a radio button in an Array of Arrays with index in a For Loop

CRHAAG

New Member
Joined
Jul 3, 2014
Messages
46
I am trying to run some macros based on whether or not a radio button is selected. I am using a For Loop to do this, but cannot figure out how to reference the button based on where its name is indexed in an array of arrays which contain references to reports, buttons, and sheet names. Here is my code:

VBA Code:
     Dim reportList As Variant


    'sheet, button, report
    reportList = Array( _
        Array("scpSumBox", "RPscopeOfWorkSummary", "Scope of Work Summary"), _
        Array("prpSumBox", "RPprpFixtures", "Proposed Fixture Summary"), _
        Array("exstSumBox", "RPexistingFixtures", "Existing Fixture Summary") _
        )

    'Cycle through list and create reports
    For i = 0 To UBound(reportList)
        If Sheets("REPORT").reportList(i)(0).Value = True Then
            Application.Run reportList(i)(1) 'This might be helpful -https://stackoverflow.com/questions/15969796/call-a-sub-with-a-string
            '
        End If
        Next i

The debugger highlights If Sheets("REPORT").reportList(i)(0).Value = True Then and states "object doesn't support this property or method." I'm assuming that reportList(i)(0) is the problem, but cannot figure out how to properly reference it.

Thanks
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Do not post duplicate questions. Posts of a duplicate nature will be deleted or locked. All related follow-ups, be they further related questions or clarifications, should be posted back to the original thread.

We advise you not to 'bump' (reply to) your own posts too quickly after posting, unless you are posting some sort of clarification. Since bumped threads have replies, they will no longer appear in the "Zero Reply Posts" listing, which many members use to look for unanswered questions. If you do bump, limit it to no more than once every day. Remember that your best helper may be asleep on the other side of the world.

Check the rules:
 
Upvote 0
Do not post duplicate questions. Posts of a duplicate nature will be deleted or locked. All related follow-ups, be they further related questions or clarifications, should be posted back to the original thread.

We advise you not to 'bump' (reply to) your own posts too quickly after posting, unless you are posting some sort of clarification. Since bumped threads have replies, they will no longer appear in the "Zero Reply Posts" listing, which many members use to look for unanswered questions. If you do bump, limit it to no more than once every day. Remember that your best helper may be asleep on the other side of the world.

Check the rules:

Hi Dante,

Maybe I am mistaken, but for me this is a different question to the one I asked earlier. It is within the same code, but my first posted question was about running a sub from an array of strings. That issue has been resolved, but I am now getting a new error which seems to be due to the fact that I am trying to reference the name of a radio button which is contained within a jagged array. So the issues are similar and the code is of course similar to that in my last thread because I am working on the same issue, but the answer to my last question does not fix the issue I am having now. I didn't think that it would be appropriate to ask a different question in the old thread, or would that be better?
 
Upvote 0
Sorry for that, it seemed the same problem, but apparently the 2 doubts in the other thread are resolved
 
Upvote 0
No worries. I'm not going to complain about getting 2 for the price of one in the other post. Thanks again.
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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