Thank you, Igor. This is great. Your explanation made the code snippet very easy to interpret.
While the layout of the grid is exactly what I was looking for, it appears that, on my PC at least, the value in the comboboxes within the Group Rows cannot be changed.
After pasting your code into my workbook and running as is, the comboboxes do not show a value and clicking on them does not display the list of options. I added ".CellValue" to your code and this displayed the value at that index in your ".Combos.Add("cbo")" definition but they still couldn't be changed:
With iGrid1
.ShowControlsInAllCells = True
With .Combos.Add("cbo")
.AddItem "Item 1", vItemValue:=1
.AddItem "Item 2", vItemValue:=2
.AddItem "Item 3", vItemValue:=3
End With
.ColCount = 3
.AddRow bGroupRow:=True, lHeight:=40
.CellType(.RowCount, .RowTextCol) = igCellCombo
.CellCtrlKey(.RowCount, .RowTextCol) = "cbo"
'I ADDED THE BELOW LINE
.CellValue(.RowCount, .RowTextCol) = 2
.AddRow btLevel:=1, lHeight:=40
.AddRow btLevel:=1, lHeight:=40
.AddRow bGroupRow:=True, lHeight:=40
.CellType(.RowCount, .RowTextCol) = igCellCombo
.CellCtrlKey(.RowCount, .RowTextCol) = "cbo"
'I ADDED THE BELOW LINE
.CellValue(.RowCount, .RowTextCol) = 3
.AddRow btLevel:=1, lHeight:=40
.AddRow btLevel:=1, lHeight:=40
End With
If it hints at what may be going on, a single click on the combobox did nothing but a double-click contracted the Child Rows within the Group.
The following is your code built into my own project. Still very basic at the moment but getting there. This adds 2 Group Rows with comboboxes and, underneath each of these, 2 Child Rows 2 columns wide with a combobox in each cell.
The comboboxes in the cells in the Child Rows behave as you would expect where I'm able to change the value, but the comboboxes in the Group Rows do not.
Do you have any ideas why this might be the case?
With iGrid1
.ShowControlsInAllCells = True
With .Combos.Add("Tasks")
.AddItem "Bridal Bouquet", vItemValue:=1
.AddItem "Bridesmaid Bouquet", vItemValue:=2
.AddItem "Boutonniere", vItemValue:=3
End With
With .Combos.Add("ItemTypes")
.AddItem "Anemone", vItemValue:=1
.AddItem "Daffodil", vItemValue:=2
.AddItem "Poppy", vItemValue:=3
End With
With .Combos.Add("ItemColors")
.AddItem "Blue", vItemValue:=1
.AddItem "Green", vItemValue:=2
.AddItem "Red", vItemValue:=3
End With
With .AddCol()
.eType = igCellCombo
.sCtrlKey = "ItemTypes"
.vValue = 1
End With
With .AddCol()
.eType = igCellCombo
.sCtrlKey = "ItemColors"
.vValue = 1
End With
.ColHeaderText(1) = "Item Type"
.ColHeaderText(2) = "Item Color"
.AutoWidthCol 1
.AutoWidthCol 2
.Header.AutoHeight
.AddRow bGroupRow:=True, lHeight:=40
.CellType(.RowCount, .RowTextCol) = igCellCombo
.CellCtrlKey(.RowCount, .RowTextCol) = "Tasks"
.CellValue(.RowCount, .RowTextCol) = 1
Dim lParentRowIndex As Long
lParentRowIndex = .RowCount
.AddRow lHeight:=40, vRowParent:=lParentRowIndex
.AddRow lHeight:=40, vRowParent:=lParentRowIndex
.AddRow bGroupRow:=True, lHeight:=40
.CellType(.RowCount, .RowTextCol) = igCellCombo
.CellCtrlKey(.RowCount, .RowTextCol) = "Tasks"
.CellValue(.RowCount, .RowTextCol) = 2
lParentRowIndex = .RowCount
.AddRow lHeight:=40, vRowParent:=lParentRowIndex
.AddRow lHeight:=40, vRowParent:=lParentRowIndex
End With
Also, I'd like to ask one more question related to this but can do so in a new forum thread if needs be: I would like to have a Quantity field associated with the combobox in the Group Row, is there any way of achieving this? I appreciate that the idea of a Group Row is that it spans the width of the grid so probably not, but it would be useful if possible. If not, could the first row within each Group have a different definition than all subsequent rows? In my example I'd have a Group Row where the Task is defined and the row immediately after this would be for entering the number of Tasks and then every subsequent row would be for defining the ItemTypes & ItemColors. For example, either of the following outcomes:

Click to View Image77 View(s)
Thank you very much,
Jason.