count the list box items but don't count the blank spaces.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • biraja
    New Member
    • Nov 2012
    • 1

    count the list box items but don't count the blank spaces.

    if in the list box 5 items are present then counter show 5 but don,t count the blank space.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    It would help to see your code.

    Comment

    • BigPapaN0z
      New Member
      • Dec 2011
      • 24

      #3
      Code:
      Dim cnt As Long
      Dim i As Long
      
      For i = 0 To List1.ListCount - 1
          If Trim(List1.List(i)) <> "" Then cnt = cnt + 1
      Next
      
      ' cnt will return how many non-blank items; we'll just print for reference. Do what you need here.
      Debug.Print "Non-Blank Entries: " & CStr(cnt)

      Comment

      Working...