0

I am trying to group some Option Buttons, several groups on a sheet. This code adds group boxes and works until I set Option Explicit On. There is no declaration for GroupBoxes, I tried

Dim gb As GroupShapes 

but get a Type Mismatch. I am a rookie at VBA, thank you in advance.

'add GroupBox
    pp = (myRow + 1 + ExamData(i, 7) - 1)
    gbRange = "B" + Trim(Str(myRow + 1)) + ":B" + Trim(Str(pp))
    Set vvv = ws.Range(gbRange)
    Set gb = ws.GroupBoxes.Add(vvv.Left, vvv.Top, vvv.Width, vvv.Height)
    With gb
        .caption = ""
        .Name = "gb" + Trim(Str(i))
    End With

I also tried using:

ws.Shapes.Range(vvv).Group

but I am getting "the index into the specific collection is out of bounds"

0 Answers0