How do I know the max date in the second column of the list box?

saftawy1

Board Regular
Joined
Oct 12, 2021
Messages
65
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
How do I know the max date in the second column of the list box?
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
For example:
VBA Code:
Debug.Print Application.WorksheetFunction.Max(Application.Index(UserForm1.ListBox1.List, 0, 2))
 
Upvote 0
Solution
Working for me ;)
How did you try it, what you got back, how do you load the Listbox, how the source data looks for?
 
Upvote 0
i try it too but not working
VBA Code:
hisham.TextBox9.Value = Application.WorksheetFunction.Max(userform1.ListBox1.List(i, 2))
 
Upvote 0
Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: how can to extract the max and min date from listbox on userform1?
There is no need to repeat the link(s) provided above but if you have posted the question at other places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0
How do I know the max date in the second column of the list box?
ty i found the solve
VBA Code:
Textbox1= Me.ListBox2.List(i, 0)
With Me.ListBox1
        For i = 0 To .ListCount - 1
            If .Selected(i) = False Then
                If CLng(.List(i, 0)) > lngMyMaxValue Then
                    lngMyMaxValue = CLng(.List(i, 0))
                End If
            End If
        Next i
    End With
     Textbox2 = lngMyMaxValue
 
Upvote 0
Post #2 answers the initial question that was asked without any specific control name or condition. Therefore, the marked solution has been switched as it provides the correct solution to the question in the general form as it was asked.
 
Upvote 0

Forum statistics

Threads
1,215,420
Messages
6,124,803
Members
449,190
Latest member
cindykay

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top