The following code works properly in Excel.
But I am looking for Power Point solution.
How to find a max value in a dictionary in Power Point Application?
Sub Macro1()
Dim dict As Object
Set dict = CreateObject("Scripting.Dictionary")
For i = 1 To 10
dict.Add Key:=i, Item:=i
Next i
For i = 0 To dict.Count - 1
Debug.Print dict.Keys()(i), dict.Items()(i)
Next i
'The following two lines works properly in Excel.
'But I am looking for Power Point solution.
Debug.Print Application.Max(dict.Items)
Debug.Print WorksheetFunction.Max(dict.Items)
End Sub
This will work in Powerpoint:
Sub Macro1()
Dim dict As Object
Set dict = CreateObject("Scripting.Dictionary")
Dim i As Long
For i = 1 To 10
dict.Add Key:=i, Item:=i
Next i
Dim iMax As Long
For i = 0 To dict.Count - 1
Debug.Print dict.Keys()(i), dict.Items()(i)
If dict.Items()(i) > iMax Then iMax = dict.Items()(i)
Next i
Debug.Print iMax
End Sub
You have to check for the max value within a loop.