I would like to either manually set the width for each column in my listview. In addition, I'd like to be able to word wrap certain columns. How can I do this?
VBA Code:
Option Explicit
Private Sub Add_Click()
End Sub
Private Sub UserForm_Activate()
With Me.LV1
.View = lvwReport
.Gridlines = True
.HideColumnHeaders = False
End With
Call LoadListView
End Sub
Private Sub LoadListView()
Dim wksSource As Worksheet
Dim rngData As Range
Dim RngCell As Range
Dim LstItem As ListItem
Dim RowCount As Long
Dim ColCount As Long
Dim i As Long
Dim j As Long
Set wksSource = Worksheets("FormDataTesting")
Set rngData = wksSource.Range("A1").CurrentRegion
For Each RngCell In rngData.Rows(1).Cells
Me.LV1.ColumnHeaders.Add Text:=RngCell.Value, Width:=90
Next RngCell
RowCount = rngData.Rows.Count
ColCount = rngData.Columns.Count
For i = 2 To RowCount
Set LstItem = Me.LV1.ListItems.Add(Text:=rngData(i, 1).Value)
For j = 2 To ColCount
LstItem.ListSubItems.Add Text:=rngData(i, j).Value
Next j
Next i
End Sub