Excel Vba List Box Warp

Опубликовано: 08 Апрель 2023
на канале: sens950
2,752
27

'''''Lesson 57 Excel '''






Private Sub UserForm_Initialize() 'form open
ListBox1.ColumnCount = 3
ListBox1.ColumnWidths = "50,200,100"


ListBox1.AddItem
ListBox1.List(ListBox1.ListCount - 1, 0) = "SlNo"
ListBox1.List(ListBox1.ListCount - 1, 1) = "Detals"
ListBox1.List(ListBox1.ListCount - 1, 2) = "Amount"
End Sub


Private Sub CommandButton1_Click() 'Add New
Dim i, c As Integer
c = 1
For i = 1 To ListBox1.ListCount - 1
If ListBox1.List(i, 0) ?? "" Then c = c + 1
Next i


ListBox1.AddItem
ListBox1.List(ListBox1.ListCount - 1, 0) = c
ListBox1.List(ListBox1.ListCount - 1, 2) = TextBox2.Text


Dim g, a As Integer
g = Len(TextBox1.Text)


For a = 1 To g Step 20


If a?= 20 Then
ListBox1.AddItem
ListBox1.List(ListBox1.ListCount - 1, 0) = ""
End If


ListBox1.List(ListBox1.ListCount - 1, 1) = Mid(TextBox1.Text, a, 20)
Next a


End Sub