Ich bin absolut unerfahren in Dingen wie diesen .
Ich habe ein recht einfaches Makro welches über mehrere Tabellenblätter reicht aufgezeichnet .
Dieses Makro kopiert Datenbereiche der ersten drei Tabellenblätter in ein viertes Tabellenblatt untereinander.
Zum Abschluss werden diese Daten im vierten Tabellenblatt sortiert .
Alle Datensätze im vierten Tabellenblatt werden nach ausführen des Makros doppelt angezeigt.
Was ist zu tun um jeden Datensatz nur einmal angezeigt zu bekommen?
Vielen Dank ich hoffe ihr wisst Rat !
Hier mein kaputtes Auto :
Code: Alles auswählen
sub gverm
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "ToPoint"
args1(0).Value = "$Barvermögen.$A$5:$E$370"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())
rem ----------------------------------------------------------------------
dim args3(0) as new com.sun.star.beans.PropertyValue
args3(0).Name = "ToPoint"
args3(0).Value = "$Gesamtvermögen.$A$5:$E$371"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args3())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Paste", "", 0, Array())
rem ----------------------------------------------------------------------
dim args5(0) as new com.sun.star.beans.PropertyValue
args5(0).Name = "ToPoint"
args5(0).Value = "$Kontostand.$A$5:$E$370"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args5())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())
rem ----------------------------------------------------------------------
dim args7(0) as new com.sun.star.beans.PropertyValue
args7(0).Name = "ToPoint"
args7(0).Value = "$Gesamtvermögen.$A$372:$E$738"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args7())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Paste", "", 0, Array())
rem ----------------------------------------------------------------------
dim args9(0) as new com.sun.star.beans.PropertyValue
args9(0).Name = "ToPoint"
args9(0).Value = "$Postbank.$A$5:$E$370"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args9())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())
rem ----------------------------------------------------------------------
dim args11(0) as new com.sun.star.beans.PropertyValue
args11(0).Name = "ToPoint"
args11(0).Value = "$Gesamtvermögen.$A$739:$E$1106"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args11())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Paste", "", 0, Array())
rem ----------------------------------------------------------------------
dim args13(0) as new com.sun.star.beans.PropertyValue
args13(0).Name = "ToPoint"
args13(0).Value = "$Gesamtvermögen.$A$5:$E$1107"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args13())
rem ----------------------------------------------------------------------
dim args14(6) as new com.sun.star.beans.PropertyValue
args14(0).Name = "ByRows"
args14(0).Value = true
args14(1).Name = "HasHeader"
args14(1).Value = false
args14(2).Name = "CaseSensitive"
args14(2).Value = false
args14(3).Name = "IncludeAttribs"
args14(3).Value = true
args14(4).Name = "UserDefIndex"
args14(4).Value = 0
args14(5).Name = "Col1"
args14(5).Value = 1
args14(6).Name = "Ascending1"
args14(6).Value = true
dispatcher.executeDispatch(document, ".uno:DataSort", "", 0, args14())
end sub