Hi all,
Anyone know how to loop through the OLE objects in a specified GroupName?
I have a macro that creates rows of option buttons to a row of a table, and I've assigned each option button a GroupName with the corresponding row number, and each button has the row and the number button it is, but I can't figure out how to loop through each option button in a specified group.
Anyone have any ideas?
Here's what I currently have:
Anyone know how to loop through the OLE objects in a specified GroupName?
I have a macro that creates rows of option buttons to a row of a table, and I've assigned each option button a GroupName with the corresponding row number, and each button has the row and the number button it is, but I can't figure out how to loop through each option button in a specified group.
Anyone have any ideas?
Here's what I currently have:
Code:
Sub resort_reconciled_meds()
Dim i, j, delRow, TableTop, TableLeft, TableRows, DataRows As Long
Dim lotarget As ListObject
Dim Rec_Sht As Worksheet
Dim Opt_Btn as Object
Set Rec_Sht = Worksheets("Reconcile Meds Here")
Set lotarget = Rec_Sht.ListObjects("Table3")
TableTop = lotarget.Range.Row
TableLeft = lotarget.Range.Column
TableRows = lotarget.DataBodyRange.Rows.Count
Sort_Index = lotarget.ListColumns("Sort").Index
DataRows = lotarget.DataBodyRange.Rows.Count
Opt_Btn_Count = 4
For i = 1 To DataRows
For j = 1 To Opt_Btn_Count
Opt_Btn = Rec_Sht.OLEObjects.Name("RecBtn" & "_" & i & "_" & j)
If Opt_Btn.Value = True Then
lotarget.DataBodyRange(i, Sort_Index).Value = j
End If
Next j
Next i
For i = 1 To TableRows
If Cells(i + TableTop, TableLeft + Sort_Index) = 4 Then
lotarget.Range.Rows(i + 1).ClearContents
Rec_Sht.Cells(i + TableTop, "c") = i
End If
Next i
For j = 1 To TableRows
If IsEmpty(Cells(TableTop + j, TableLeft)) = False Then
DataRows = DataRows + 1
End If
Next j
lotarget.Resize lotarget.Range.Resize(DataRows + 1, lotarget.Range.Columns.Count)
End Sub