Thank You Bakerman2 for reply
i am using this code to fill my listbox
and want to populate data of Sheets("entry")
Private Sub OptionButton1_Click()
Dim Sh As Worksheet, LR As Long
Set Sh = Sheets("ENTRY")
With Sh
LR = .Range("C" & .Rows.Count).End(xlUp).Row
'Me.Label1.Caption = "Total [ " & Application.WorksheetFunction.CountIF(.Range("Q10:Q" & LR), ">" & "0") & " ] Transaction Found"
vl2 = .Application.WorksheetFunction.CountIF(.Range("Q10:Q" & LR), ">0") ' start form
For j = 10 To LR ' stating row
If vl2 > 0 Then
vl = .Range("Q" & j).Value
If vl > 0 Then
r = j
ListBox1.AddItem
For k = 0 To 16
ListBox1.List(ListBox1.ListCount - 1, k) = .Cells(r, k + 3)
Next
End If
Else
' MsgBox "There is No Greater Than Zero(0) Value", vbInformation, "Greater Than Zero"
Exit Sub
End If
Next
End With
End Sub
Private Sub UserForm_Initialize()
Dim Sh As Worksheet, LR As Long
Set Sh = Sheets("ENTRY")
With Sh
LR = .Range("C" & .Rows.Count).End(xlUp).Row
Me.ListBox1.ColumnCount = 16
Me.ListBox1.ColumnWidths = "1.5in;1in;.0in;.0in;.0in;.0in;.0in;.0in;.0in;.0in;.0in;.0in;.0in;0in;.5in;.5in;"
Const cols = 16
Dim listarray(0, 0 To cols) As Variant
For col = 0 To cols
listarray(0, col) = .Cells(9, col + 3)
Next col
Me.ListBox1.List = listarray
Me.ListBox1.ListIndex = -1
End With
Me.OptionButton1 = True
End Sub
Bookmarks