Hello everyone,
First of all English is not my native language. Sorry for my misspellings.
I have an excel macro that I need to edit. I will briefly summarize the operations in Excel and then I will ask my question.
Operation summary: Customer, with buttons in Excel; enters a Sender account, then enters the Receiver account. After these operations, he presses the Add New Payment button. The Sender Account and the Recipient Account have to choose the same currencies. After the Buyer selects the account currency, the recipients of the selected currency appear in the list. After entering the necessary information, press the Add button and the information will be written to the cells in another sheet.
In the macro I currently have, I could not sort Alphabetically by Recipient Name, as the Recipient information is obtained with the ComboBox. For this reason, I converted ComboBox to ListBox and was able to sort it alphabetically.
But I can't select or use the data I pulled to ListBox. I need to select the Recipient Account I want in the ListBox and make a payment entry for it. (I need to print the data I selected here into cells in another sheet)
In short: I want to select and use the data drawn from another sheet into the Listbox.
I am using the following code to pull the Receiver Account Information:
But after pulling this data, I can't select and use it 
In the ComboBox, the data is drawn with the codes below. But it is not possible to sort alphabetically by Account Name in ComboBox.
I hope I'm wrong and the data in the ComboBox can be sorted alphabetically by Account Name(ReceiverName)
First of all English is not my native language. Sorry for my misspellings.
I have an excel macro that I need to edit. I will briefly summarize the operations in Excel and then I will ask my question.
Operation summary: Customer, with buttons in Excel; enters a Sender account, then enters the Receiver account. After these operations, he presses the Add New Payment button. The Sender Account and the Recipient Account have to choose the same currencies. After the Buyer selects the account currency, the recipients of the selected currency appear in the list. After entering the necessary information, press the Add button and the information will be written to the cells in another sheet.
In the macro I currently have, I could not sort Alphabetically by Recipient Name, as the Recipient information is obtained with the ComboBox. For this reason, I converted ComboBox to ListBox and was able to sort it alphabetically.
But I can't select or use the data I pulled to ListBox. I need to select the Recipient Account I want in the ListBox and make a payment entry for it. (I need to print the data I selected here into cells in another sheet)
In short: I want to select and use the data drawn from another sheet into the Listbox.
I am using the following code to pull the Receiver Account Information:
VBA Code:
Dim i As Range
With Sheets("Alici Hesap Bilgileri")
Set i = .Range("A1:I" & .Range("A" & .Rows.Count).End(xlUp).Row)
End With
Me.ListBox1.List = i.Value
Me.ListBox1.ColumnCount = 9

In the ComboBox, the data is drawn with the codes below. But it is not possible to sort alphabetically by Account Name in ComboBox.
I hope I'm wrong and the data in the ComboBox can be sorted alphabetically by Account Name(ReceiverName)

VBA Code:
Private Sub CbReceiver_Change()
With CbReceiver
.ColumnWidths = "20in"
If CbReceiver.ListCount > 0 Then
If Len(Me.CbReceiverCurrency.Value) = 0 Then
tempIndex = .ListIndex + 2
Else
tempIndex = ReceiverIndexes(.ListIndex)
End If
ReceiverName = ThisWorkbook.Sheets("Alici Hesap Bilgileri").Cells(tempIndex, 2)
ReceiverCurrency = ThisWorkbook.Sheets("Alici Hesap Bilgileri").Cells(tempIndex, 3)
ReceiverIban = ThisWorkbook.Sheets("Alici Hesap Bilgileri").Cells(tempIndex, 4)
ReceiverTaxOffice = ThisWorkbook.Sheets("Alici Hesap Bilgileri").Cells(tempIndex, 5)
ReceiverTaxId = ThisWorkbook.Sheets("Alici Hesap Bilgileri").Cells(tempIndex, 6)
ReceiverCity = ThisWorkbook.Sheets("Alici Hesap Bilgileri").Cells(tempIndex, 7)
ReceiverAddress = ThisWorkbook.Sheets("Alici Hesap Bilgileri").Cells(tempIndex, 8)
End If
End With
End Sub
Private Function FillReceiver(currencyTxt As String) As Boolean
Set ReceiverIndexes = New ArrayList
lrows = ThisWorkbook.Sheets("Alici Hesap Bilgileri").UsedRange.Rows.Count
If lrows >= 2 Then
With Me.CbReceiver
.Clear
If Len(currencyTxt) = 0 Then
For i = 2 To lrows
.AddItem (ThisWorkbook.Sheets("Alici Hesap Bilgileri").Cells(i, 9) & " <-> " & ThisWorkbook.Sheets("Alici Hesap Bilgileri").Cells(i, 2) & " <-> " & ThisWorkbook.Sheets("Alici Hesap Bilgileri").Cells(i, 4) & " <-> " & ThisWorkbook.Sheets("Alici Hesap Bilgileri").Cells(i, 3) & " Hesap")
Next i
.ListIndex = 0
Else
For i = 2 To lrows
If ThisWorkbook.Sheets("Alici Hesap Bilgileri").Cells(i, 3) = currencyTxt Then
.AddItem (ThisWorkbook.Sheets("Alici Hesap Bilgileri").Cells(i, 9) & " <-> " & ThisWorkbook.Sheets("Alici Hesap Bilgileri").Cells(i, 2) & " <-> " & ThisWorkbook.Sheets("Alici Hesap Bilgileri").Cells(i, 4) & " <-> " & ThisWorkbook.Sheets("Alici Hesap Bilgileri").Cells(i, 3) & " Hesap")
ReceiverIndexes.Add i
End If
Next i
If .ListCount > 0 Then
.ListIndex = 0
Else
.ListIndex = -1
End If
End If
End With
End If
FillReceiver = True
End Function