white_flag
04-20-2010, 03:02 AM
hello
how can an listview be populated with an dynamic range?
Private Sub UserForm_Activate()
Dim i As Long
Dim li As ListItem
On Error GoTo Eroare:
With Me.ListView1
.ColumnHeaders.Add , , "Name", Me.TextBox2.Width 'Add columns
.ColumnHeaders.Add , , "Density", Me.TextBox1.Width
.HideColumnHeaders = False 'set some properties
.View = lvwReport
.Gridlines = True
.ListItems = Range("B2:F2").Value - not working
'.ListItems = Range("name").Value - not working
For i = 1 To mcolRecords.Count 'populate listview
Set li = .ListItems.Add(, , mcolRecords(i).Name)
li.SubItems(1) = mcolRecords(i).Density
Next i
ListView1_ItemClick .ListItems(.SelectedItem.Index) 'fill edit controls
End With
Eroare:
'MsgBox "error"
End Sub
"name" is: =OFFSET(Sheet1!A3;0;1;1;COUNTA(Sheet1!$1:$1)-1) in excel
thank you.
how can an listview be populated with an dynamic range?
Private Sub UserForm_Activate()
Dim i As Long
Dim li As ListItem
On Error GoTo Eroare:
With Me.ListView1
.ColumnHeaders.Add , , "Name", Me.TextBox2.Width 'Add columns
.ColumnHeaders.Add , , "Density", Me.TextBox1.Width
.HideColumnHeaders = False 'set some properties
.View = lvwReport
.Gridlines = True
.ListItems = Range("B2:F2").Value - not working
'.ListItems = Range("name").Value - not working
For i = 1 To mcolRecords.Count 'populate listview
Set li = .ListItems.Add(, , mcolRecords(i).Name)
li.SubItems(1) = mcolRecords(i).Density
Next i
ListView1_ItemClick .ListItems(.SelectedItem.Index) 'fill edit controls
End With
Eroare:
'MsgBox "error"
End Sub
"name" is: =OFFSET(Sheet1!A3;0;1;1;COUNTA(Sheet1!$1:$1)-1) in excel
thank you.