ich würde das so lösen:
Code: Alles auswählen
Sub Buttons1_8
dim Celloffset as Integer
oDoc = thisComponent
oController = oDoc.getCurrentController()
oSheet = oDoc.Sheets().getbyname("Tabelle1_2")'hier liegen die Buttons
oSheetGoal = oDoc.Sheets().getbyname("Tabelle1_3")
oForm = oSheet.drawpage.forms.getbyindex(0)
for j = 1 to 8
Btn_Name = "PushButton" & j
oControl = oForm.getByName(Btn_Name)
oButton = oController.getControl(oControl)
oButton.Model.Enabled = true
nCelloffset = j -1
cCols = Array (1,2,5,6)
for i = 0 To uBound(cCols)
intCol = nCelloffset * 12 + cCols(i)
oCellRange = oSheet.getCellRangeByPosition(intCol,0,intCol,500).getdataarray
oSheetGoal.getCellRangeByPosition(intCol,0,intCol,500).setdataarray(oCellRange)
next i
next j
MsgBox "Done ",64,"Copy Range"
End Sub
Jürgen