- Katılım
- 11 Mart 2005
- Mesajlar
- 3,049
- Excel Vers. ve Dili
- Office 2013 İngilizce
Merhaba,
Collection nesnesinde ITEM değerinden KEY değerine nasıl ulaşabilirz?
Özetle Aşağıdaki kodda "Google" değerinde "33" değerine nasıl oluşabiliriz?
desteğiniz için şimden teşekkürler,
iyi Geceler
Collection nesnesinde ITEM değerinden KEY değerine nasıl ulaşabilirz?
Özetle Aşağıdaki kodda "Google" değerinde "33" değerine nasıl oluşabiliriz?
desteğiniz için şimden teşekkürler,
iyi Geceler
Kod:
Sub test()
Dim iCtr As Integer
Dim itemCount As Integer
Dim myData As Collection
Set myData = New Collection
Dim searchFor As String
myData.Add "MS", "11"
myData.Add "Oracle", "22"
myData.Add "Google", "33"
'** Searching based on value
searchFor = "Google"
itemCount = myData.Count
For iCtr = 1 To itemCount
If myData(iCtr) = searchFor Then
MsgBox myData(iCtr)
Exit For
End If
Next
'** Searching by key
MsgBox myData.Item("22")
End Sub