Sub number_of_last_row_in_column_A
sheet = ThisComponent.getSheets().getByName("sheet1")
range = sheet.getCellRangeByPosition(0, 0, 0, 65535)
empties = range.queryEmptyCells
full = sheet.getCellRangeByPosition(0, 0, 0, empties.RangeAddresses(0).startRow + 1)
lastrow = full.RangeAddress.EndRow
sheet.getCellByPosition(1,0).setValue(lastrow) 'puts the result in B1 cell
End Sub
sub main4
Dim Doc As Object
Dim Sheet As Object
Dim CellRangeAddress As New com.sun.star.table.CellRangeAddress
Dim CellAddress As New com.sun.star.table.CellAddress
Doc = ThisComponent
Sheet = Doc.Sheets(0)
CellRangeAddress.Sheet = 0
CellRangeAddress.StartColumn = 0
CellRangeAddress.StartRow = 0
CellRangeAddress.EndColumn = 10
CellRangeAddress.EndRow = 0
CellAddress.Sheet = 0
CellAddress.Column = 0
CellAddress.Row = 25
Sheet.copyRange(CellAddress, CellRangeAddress)
end sub
JEDINOU věcí kerá mi zbývá dořešit je jak naučit makro najít konec dat(bez UNO)-abych tuto proměnlivou(:-D proměnnou samozřejmě) mohl nastavit do "CellAddress. ..."
]]>sub copy_A1_Z1_paste_end_of_data
dim document as object : document = ThisComponent.CurrentController.Frame
dim dispatcher as object : dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "ToPoint"
args1(0).Value = "sheet1.$A$1:$Z$1"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())
dispatcher.executeDispatch(document, ".uno:GoToEndOfData", "", 0, args1())
dispatcher.executeDispatch(document, ".uno:GoDown", "", 0, args1())
dispatcher.executeDispatch(document, ".uno:GoToStartOfRow", "", 0, args1())
dispatcher.executeDispatch(document, ".uno:Paste", "", 0, Array())
end sub
nebo to makro předtím,jak jsem vložil, tak to naučit najít konec dat(a popřípadě naučit jak vložit zkopírovaná data,ale to už není nezbytně nutné-znám způsob který je ale namáhavý-musí se udělat příkaz pro každou zopírovanou a vklaádano bunku)
tak kdyby někdo věděl pánové,tak diky!
]]>sub kopiruj
dim document as object : document = ThisComponent.CurrentController.Frame
dim dispatcher as object : dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "ToPoint"
args1(0).Value = "$A$1:$Z$1"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())
args1(0).Name = "ToPoint"
args1(0).Value = "$A$10"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
dispatcher.executeDispatch(document, ".uno:Paste", "", 0, Array())
end sub
sub main
list = ThisComponent.getSheets().getByIndex(0)
zdroj = list.getCellRangeByName( "A1:Z1" )
list.getCellByPosition(0,9).setString(zdroj)
end sub
no ale nefunguje to a hlasi to furt chyby,tak kdybyste někdo věděl...diky
]]>