Sie sind auf Seite 1von 4

Private Sub UserForm_Initialize()

With ListView1
.ColumnHeaders.Clear
.ColumnHeaders.Add , , "Class"
.ColumnHeaders.Add , , "Address"
.ColumnHeaders.Add , , "Value"
.AllowColumnReorder = False
.Gridlines = True
.View = lvwReport
For Each Cell In Worksheets("Sheet1").Range("A1:A10")
With Worksheets("Sheet2").Range("A1:A20")
Set c = .Find(Cell, LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
Set c = .FindNext(c)
ListView1.ListItems.Add , , c
j = ListView1.ListItems.Count
'ListView1.ListItems.Add , , c.Address
ListView1.ListItems(j).ListSubItems.Add , , c.Address
ListView1.ListItems(j).ListSubItems.Add , , c.Offset(0,
1)

Loop While Not c Is Nothing And c.Address <> firstAddress


End If
'ListView1.ListItems.Add , , cell
End With
x = ListView1.ListItems.Count
ListView1.ListItems.Add , , "Total"
ListView1.ListItems(x).ListSubItems.Add , , "*"
i = ListView1.ListItems.Count
ListView1.ListItems(i).Bold = True
'ListView1.ListItems(j).ListSubItems.Add , , "c.Address"
Next

End With

' With Worksheets(1).Range("a1:a500")


' Set c = .Find(2, LookIn:=xlValues)
' If Not c Is Nothing Then
'firstAddress = c.Address
' Do
''' c.Value = 5
' Set c = .FindNext(c)
' If c Is Nothing Then
' GoTo DoneFinding
' End If
'' Loop While Not c Is Nothing And c.Address <> firstAddress
' End If
'DoneFinding:
'End With

End Sub

*****************************
'For i = 2 To RowCount
' Set LstItem = Me.ListView1.ListItems.Add(Text:=rngData(i, 1).Value)
' For j = 2 To ColCount
' LstItem.ListSubItems.Add Text:=rngData(i, j).Value
' Next j
' Next i

' Classe 1
' Nombre de classe 1
' .Find(What, After, LookIn, LookAt, SearchOrder, SearchDirection, M
atchCase, MatchByte, SearchFormat)

End With
'''''''''''''''''''''''
Dim class1 As Range
For Each class1 In Worksheets("Class1").Range("A1:A20")
ListBox3.AddItem class1
Next
'For Each class1 In Worksheets("Class1").Range("A1:A20")

Dim name2 As String: name2 = "138"


Dim rgSearch As Range
Set rgSearch = Worksheets("Journal").Range("F1:F100")
Dim cell As Range
Set cell = rgSearch.Find(name2)
If cell Is Nothing Then
TextBox1.Text = "Name was not found."
Exit Sub
End If
' Store first cell address
Dim firstCellAddress As String
Dim cellnb As Integer
Dim sum As Integer
cellnb = 2
firstCellAddress = cell.Address
ListView2.ListItems.Add , , "138"
ListView2.ListItems(1).Bold = True
For i = 1 To 6
ListView2.ListItems(1).ListSubItems.Add , , ""
Next
ListBox2.AddItem "Account 138"
Do
ListBox2.AddItem cell & " " & cell.Offset(0, -4) & "/" & cell.Offset(
0, -3) & "/" & cell.Offset(0, -2) & " " & cell.Offset(0, 4)
ListView2.ListItems.Add , , cell
Set cell = rgSearch.FindNext(cell)
ListView2.ListItems(cellnb).ListSubItems.Add , , cell.Offset(0, -4) & "/
" & cell.Offset(0, -3) & "/" & cell.Offset(0, -2)
ListView2.ListItems(cellnb).ListSubItems.Add , , cell.Offset(0, -5)
ListView2.ListItems(cellnb).ListSubItems.Add , , cell.Offset(0, -1)
ListView2.ListItems(cellnb).ListSubItems.Add , , cell.Offset(0, 4)
ListView2.ListItems(cellnb).ListSubItems.Add , , ""
If cellnb = 1 Then
sum = cell.Offset(0, 4)
ListView2.ListItems(cellnb).ListSubItems.Add , , sum
'End If
Else:
sum = sum + cell.Offset(0, 4)
ListView2.ListItems(cellnb).ListSubItems.Add , , sum
End If
cellnb = cellnb + 1
Loop While firstCellAddress <> cell.Address
'ListView2.ListItems(cell).ListSubItems.Add , , cell.Offset(0, 4) + List
View2.ListItems.Item(1).ListSubItems(4)

Das könnte Ihnen auch gefallen