У меня есть список с несколькими выборками, и я хочу вставить выбранные элементы в диапазоне от F до M в последние пустые ячейки.Я уже ограничил возможный выбор до 8.
Я уже пробовал следующий код:
Dim i As Integer
With machwas.ListBox1
For i = 0 To .ListCount - 1
If .Selected(i) Then
If Cells(last, 6).Value = "" Then
ActiveSheet.Cells(last, 6).Value = .List(i)
If Cells(last, 7).Value = "" Then
ActiveSheet.Cells(last, 7).Value = .List(i)
If Cells(last, 8).Value = "" Then
ActiveSheet.Cells(last, 8).Value = .List(i)
If Cells(last, 8).Value = "" Then
ActiveSheet.Cells(last, 8).Value = .List(i)
If Cells(last, 9).Value = "" Then
ActiveSheet.Cells(last, 9).Value = .List(i)
If Cells(last, 10).Value = "" Then
ActiveSheet.Cells(last, 10).Value = .List(i)
If Cells(last, 11).Value = "" Then
ActiveSheet.Cells(last, 11).Value = .List(i)
If Cells(last, 12).Value = "" Then
ActiveSheet.Cells(last, 12).Value = .List(i)
If Cells(last, 13).Value = "" Then
ActiveSheet.Cells(last, 13).Value = .List(i)
If Cells(last, 14).Value = "" Then
ActiveSheet.Cells(last, 14).Value = .List(i)
End If
Else
End If
Next i
Но он показывает мне первый выбор из списка в каждом последнем столбце.