I am using getDataArray() and setDataArray() to copy and paste column from one spreadsheet to another in open office basic. I need solution for the following mentioned below which I tried to get but unable to.
1)I am hard coding the cell range references. I exactly know which column to copy but doesn't know the end of the row that contains data. How can I achieve this using getCellRangeByName() method. Now I am giving reference as "A2:A10" . The end range varies.
2)when using setDataArray() for pasting I want the cell to be pasted in paste special->numbers and text only. How can I code this
3)After copy paste is done between the documents I want to select all data of the spreadsheet and format it as text. How can I achieve this.
[Solved] Paste special: get last row containing data in col
-
- Posts: 52
- Joined: Wed Aug 22, 2018 5:47 pm
[Solved] Paste special: get last row containing data in col
Last edited by Kprogrammer on Thu Sep 06, 2018 1:32 pm, edited 3 times in total.
Open office 3.1 on Windows 7
Re: Using paste special, getting last row containing data in
Use a template file as target file with preformatted cells. Format the cells by Styles but not direct (manual) formatting properties.3)After copy paste is done between the documents I want to select all data of the spreadsheet and format it as text. How can I achieve this.
And you can create, modify and aply the cell styles by your macro. (See Andrew Pitonyak's free macro books.)
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
-
- Volunteer
- Posts: 1547
- Joined: Wed Jun 24, 2015 12:56 am
- Location: Colorado, USA
Re: Using paste special, getting last row containing data in
In addition to his book, Andrew Pitonyak has a Macro document titled "Useful Macro Information" that can be downloaded from:I exactly know which column to copy but doesn't know the end of the row that contains data.
http://www.pitonyak.org/oo.php
Section 6.22 of the document has this little gem.
Code: Select all
Function GetLastUsedRow(oSheet) As Integer
Dim oCursor
oCursor = oSheet.createCursor
oCursor.GotoEndOfUsedArea(True)
GetLastUsedRow = oCursor.RangeAddress.EndRow
End Function
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11