View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
patrick molloy patrick molloy is offline
external usenet poster
 
Posts: 391
Default Datagrid ActiveX Control

I have a flexgrid which I populate from a range thus:

Private Sub LoadFlex()

Dim rSource As Range
Set rSource = NamedRange(DATA_EXTRACT)
Dim index As Long 'loop counter
Dim rw As Long
With MSFlexGrid1

.Cols = rSource.Columns.count
.Rows = rSource.Rows.count
.Row = 0
For index = 0 To .Cols - 1
.col = index
.text = rSource.Cells(1, index + 1).Value
Next
For rw = 2 To rSource.Rows.count
.Row = rw - 1
For index = 0 To .Cols - 1
.col = index
.text = rSource.Cells(rw, index + 1).Value
Next index

Next rw

End With

End Sub


here, DATA_EXTRACT is a constant,"Data.Extract" which in
the workbook is a named range.

HTH
Patrick Molloy
Microsoft Excel MVP

-----Original Message-----
Does the Datagrid control work when used on Excel
UserForm? When I run my UserForm, the control is
displayed but I am unable to enter any data. All of the
microsoft docs I see only refer to VB use of the

control,
not VBA.
Same question about the MOWC spreadsheet control.

Thanks for your help,
Mike
.