Hi Guys,

I am using the following code to resize listview columns according to their contents.

Code:
For Col2Adjust = 1 To Lv.ColumnHeaders.count - 1
      If (Col2Adjust = 2) Then
        Debug.Print Lv.ColumnHeaders(2).Width
        If (Lv.ColumnHeaders(2).Width > 6423.875) Then
            Call SendMessage(Lv.hWnd, _
                       LVM_SETCOLUMNWIDTH, _
                       Col2Adjust, _
                       ByVal LVSCW_AUTOSIZE_USEHEADER)
        End If
      Else
      Call SendMessage(Lv.hWnd, _
                       LVM_SETCOLUMNWIDTH, _
                       Col2Adjust, _
                       ByVal LVSCW_AUTOSIZE_USEHEADER)
      End If
   Next
As you can see I want to skip column 2. I only want to resize column 2 if the width is greater than what I have specified there. But it isn't working.

Any ideas.