Listview check box value sorting in textbox in ascending

ping0775

New Member
Joined
Jul 18, 2022
Messages
40
Office Version
  1. 2007
Platform
  1. Windows
Private Sub UtilizeBtn_Click()
SalesReceiptPaidAmountForm.Show

Dim y As Integer
For y = 1 To 7
If Me.ListView1.ListItems(y).Checked = True Then
With SalesReceiptPaidAmountForm
.TextBox1.Text = Me.ListView1.ListItems(y).ListSubItems(1)
.TextBox2.Text = Me.ListView1.ListItems(y).ListSubItems(2)
.TextBox3.Text = Me.ListView1.ListItems(y).ListSubItems(3)
.TextBox4.Text = Me.ListView1.ListItems(y).ListSubItems(4)
.TextBox5.Text = Me.ListView1.ListItems(y).ListSubItems(5)
.TextBox6.Text = Me.ListView1.ListItems(y).ListSubItems(6)
.TextBox7.Text = Me.ListView1.ListItems(y).ListSubItems(7)
.TextBox8.Text = Me.ListView1.ListItems(y).ListSubItems(1)
.TextBox9.Text = Me.ListView1.ListItems(y).ListSubItems(2)
.TextBox10.Text = Me.ListView1.ListItems(y).ListSubItems(3)
.TextBox11.Text = Me.ListView1.ListItems(y).ListSubItems(4)
.TextBox12.Text = Me.ListView1.ListItems(y).ListSubItems(5)
.TextBox13.Text = Me.ListView1.ListItems(y).ListSubItems(6)
.TextBox14.Text = Me.ListView1.ListItems(y).ListSubItems(7)
MsgBox Me.ListView1.ListItems(y)



End With
End If
Me.ListView1.ListItems(y).Checked = False
Next y
End Sub
I have a listview loading my invoice data,
i create a checkbox next to it.
when i tick the listview and click on the utilize button.
how to make it like in asceding appear in each different textbox1......textbox 49?
how to make like
textbox 1 -7 for value in checkbox 1
textbox 8-14 for value in checkbox 2
textbox 15-21 for value in checkbox 3
textbox 16-28 for value in checkbox 4 etc.....

plssss i been revolve this issue for dayssss
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Is the listview control and textboxes located within the same userform. If so, maybe...

VBA Code:
    Dim li As ListItem
    Dim i As Long
    Dim j As Long
  
    With Me.ListView1
        For i = 1 To .ListItems.Count
            Set li = .ListItems(i)
            For j = 1 To li.ListSubItems.Count
                Me.Controls("TextBox" & i * 7 - 7 + j).Text = IIf(li.Checked, li.ListSubItems(j).Text, "")
            Next j
        Next i
    End With

Hope this helps!
 
Last edited:
Upvote 0
Solution
Is the listview control and textboxes located within the same userform. If so, maybe...

VBA Code:
    Dim li As ListItem
    Dim i As Long
    Dim j As Long
 
    With Me.ListView1
        For i = 1 To .ListItems.Count
            Set li = .ListItems(i)
            For j = 1 To li.ListSubItems.Count
                Me.Controls("TextBox" & i * 7 - 7 + j).Text = IIf(li.Checked, li.ListSubItems(j).Text, "")
            Next j
        Next i
    End With

Hope this helps!
thank you for the assistant this way look much more easier.
i had fixed with offset listviewitem to excel sheet them from there extract.
 
Upvote 0

Forum statistics

Threads
1,223,275
Messages
6,171,121
Members
452,381
Latest member
Nova88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top