RE.MOTO
2021-02-09 07:46:51 UTC
Norman Joans facendo riferimento a questo tuo contributo in questo link https://groups.google.com/g/microsoft.public.it.office.excel/c/F2AeqHhdwuA/m/MUK3IjDGyaMJ ho provato a ragionarci subito ed in poche righe rintracciate ho compreso chiaramente che il tuo contribuito del 2007 sollecitato da Solaris faceva (e fa!) al caso mio. Già Paganini non si ripete ma .... sarebbe possibile avere un tuo nuovo contributo su uno stesso tema suonato con diverse corde?
te ne sarei davvero grato:
1) E' possibile, sempre in modo dinamico, chiedere a VBA, una volte che ha creato degli oggetti, (in questo caso 3 pulsanti di opzione ed una casella di gruppo), di creare un raggruppamento degli stessi creati dinamicamente all'interno della routine?
2) E' possibile modificare la routine facendo si che se viene ri-eseguita non venga eseguita sulle righe dove ha già svolto la sua funzione?
Questa è la routine che ho modificato partendo dalla sua postata nel link:
Public Sub Test_Control_OptBtn()
'
Dim WB As Workbook
Dim SH As Worksheet
Dim Rng As Range
Dim rCell As Range
Dim arrCaption As Variant
'
Set WB = Workbooks("HPP.xlsm") '<<======= da CAMBIARE
Set SH = WB.Sheets("INSERIMENTO") '<<===== da CAMBIARE
Set Rng = SH.Range("C2:C25") '<<========= da CAMBIARE
'
Application.ScreenUpdating = False
'
For Each rCell In Rng.Cells
If rCell <> "" Then
'
'CASELLA DI GRUPPO
With ActiveSheet.GroupBoxes.Add(rCell.Left + 10, rCell.Top + 7, 460, 57)
.Caption = "Prestazione n° " & rCell.Row - 1
End With
'
'PIANIFICAZIONE
With ActiveSheet.OptionButtons.Add(rCell.Left + 300, rCell.Top + 30, 14, 9)
.Caption = "P" & rCell.Row - 1
.LinkedCell = "$G$" & rCell.Row
End With
'
'PRENOTAZIONE
With ActiveSheet.OptionButtons.Add(rCell.Left + 360, rCell.Top + 30, 14, 9)
.Caption = "!"
.LinkedCell = "$G$" & rCell.Row
End With
'
'ESECUZIONE
With ActiveSheet.OptionButtons.Add(rCell.Left + 420, rCell.Top + 30, 14, 9)
.Caption = "E"
.LinkedCell = "$G$" & rCell.Row
End With
End If
'
rCell.Font.Color = vbBlack
'
Next rCell
Application.ScreenUpdating = True
'
End Sub
Grazie
.G.R.
te ne sarei davvero grato:
1) E' possibile, sempre in modo dinamico, chiedere a VBA, una volte che ha creato degli oggetti, (in questo caso 3 pulsanti di opzione ed una casella di gruppo), di creare un raggruppamento degli stessi creati dinamicamente all'interno della routine?
2) E' possibile modificare la routine facendo si che se viene ri-eseguita non venga eseguita sulle righe dove ha già svolto la sua funzione?
Questa è la routine che ho modificato partendo dalla sua postata nel link:
Public Sub Test_Control_OptBtn()
'
Dim WB As Workbook
Dim SH As Worksheet
Dim Rng As Range
Dim rCell As Range
Dim arrCaption As Variant
'
Set WB = Workbooks("HPP.xlsm") '<<======= da CAMBIARE
Set SH = WB.Sheets("INSERIMENTO") '<<===== da CAMBIARE
Set Rng = SH.Range("C2:C25") '<<========= da CAMBIARE
'
Application.ScreenUpdating = False
'
For Each rCell In Rng.Cells
If rCell <> "" Then
'
'CASELLA DI GRUPPO
With ActiveSheet.GroupBoxes.Add(rCell.Left + 10, rCell.Top + 7, 460, 57)
.Caption = "Prestazione n° " & rCell.Row - 1
End With
'
'PIANIFICAZIONE
With ActiveSheet.OptionButtons.Add(rCell.Left + 300, rCell.Top + 30, 14, 9)
.Caption = "P" & rCell.Row - 1
.LinkedCell = "$G$" & rCell.Row
End With
'
'PRENOTAZIONE
With ActiveSheet.OptionButtons.Add(rCell.Left + 360, rCell.Top + 30, 14, 9)
.Caption = "!"
.LinkedCell = "$G$" & rCell.Row
End With
'
'ESECUZIONE
With ActiveSheet.OptionButtons.Add(rCell.Left + 420, rCell.Top + 30, 14, 9)
.Caption = "E"
.LinkedCell = "$G$" & rCell.Row
End With
End If
'
rCell.Font.Color = vbBlack
'
Next rCell
Application.ScreenUpdating = True
'
End Sub
Grazie
.G.R.