Daten aus ListView exportieren
21.06.2015 20:25:35
DirkR
ich habe dank der Hilfe aus dem Forum folgenden Code zum Befüllen von ListView1 in einer UF (bei Veränderung einer Textbox). Das funktioniert auch super. Nun möchte ich zusätzlich einen CommandButton, der den gesamten Inhalt von ListView1 in eine "neue" Arbeitsmappe kopiert.
Ich komme da einfach nicht weiter und bitte um Hilfe!
Hier mein Code:
Klassenmodul - Klasse1
Option Explicit
Option Compare Text
Public WithEvents objText As MSForms.TextBox
Private Sub objText_Change()
'Kontaktinfos.TextBox21 = Format(Kontaktinfos.TextBox21, "#,###.00 ")
Application.ScreenUpdating = False
Dim ArList
Dim booFund As Boolean, booListeLeer As Boolean
Dim nCount&, n&, nn&
With Kontaktinfos
.Frame1.Caption = "Kundenübereinstimmungen"
.ListView1.BackColor = -2147483643 '12632064
If .Tag "" Then Exit Sub
With Tabelle1
ArList = .Range("F2", .Cells(.Rows.Count, 7).End(xlUp)).Resize(, 30)
End With
booListeLeer = True
For n = LBound(ArTxT) To UBound(ArTxT)
If ArTxT(n).objText "" Then booListeLeer = False: Exit For
Next n
ListView_ScreenUpdating .ListView1, False
With .ListView1
.ListItems.Clear
For n = 3 To UBound(ArList)
If Not booListeLeer Then
booFund = True
For nn = 1 To 30
If Not (ArList(n, nn) Like ArTxT(nn).objText & "*") _
And ArTxT(nn).objText "" Then
booFund = False
Exit For
End If
Next nn
End If
If booFund Or booListeLeer Then
nCount = nCount + 1
.ListItems.Add nCount, , ArList(n, 1)
For nn = 2 To 30
.ListItems(nCount).SubItems(nn - 1) = ArList(n, nn)
Next nn
booFund = False
End If
Next n
End With
LVColumnWidth .ListView1, True
ListView_ScreenUpdating .ListView1, True
End With
Application.ScreenUpdating = True
End Sub
Vielen Dank schon mal im Voraus.Gruß DirkR