maxblack
New Member
- Joined
- Nov 15, 2016
- Messages
- 36
Hello Guys,
I need your support with one thing related to Userfrom, which I'm preparing. I must to say that I'm pretty fresh in userforms, I'm still learning this part of VBA.
Anyway, I have a listbox with accounts, which should be deleted from the main report. I'm preparing the DeleteButton, which will be deleting account or accounts (possible multiple selection) from this list, which is in sheet("Setup"). i have already dony AddButton, which is working correcctly, but i have the problem with Delete.
I build following code:
If I select single account it works, but if I select multiple it delete values not properly.
I'm sure that I made a mistake in this loop.
But I have a new idea, but I don't know if it is possible with userfrom.
Is is possible to add multi selected values to AutoFilt Array?
i would be great if macro will be selecting this way the account and delete the whole selection?
Thanks for you support!
max
I need your support with one thing related to Userfrom, which I'm preparing. I must to say that I'm pretty fresh in userforms, I'm still learning this part of VBA.
Anyway, I have a listbox with accounts, which should be deleted from the main report. I'm preparing the DeleteButton, which will be deleting account or accounts (possible multiple selection) from this list, which is in sheet("Setup"). i have already dony AddButton, which is working correcctly, but i have the problem with Delete.
I build following code:
Code:
Private Sub DeleteButton_Click()
Set wb = ThisWorkbook
Dim i As Integer
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) Then
'ListBox1.RemoveItem i
Sheets("Setup").Rows(i + 1).EntireRow.Delete
End If
Next i
Unload Me
LoadList
End Sub
I'm sure that I made a mistake in this loop.
But I have a new idea, but I don't know if it is possible with userfrom.
Is is possible to add multi selected values to AutoFilt Array?
i would be great if macro will be selecting this way the account and delete the whole selection?
Thanks for you support!
max