| View previous topic :: View next topic |
| Author |
Message |
heymish General User


Joined: 08 Mar 2007 Posts: 5 Location: Christchurch, New Zealand
|
Posted: Thu Mar 08, 2007 6:12 pm Post subject: Add Row to a Range |
|
|
I have definded a range of cells using Data -> Define Range. I am adding data to this Range from Base using a macro.
I would like to be able to add another row to the range as I need so I can keep adding data from Base.
Sorry all a bit new to this. |
|
| Back to top |
|
 |
Villeroy Super User


Joined: 04 Oct 2004 Posts: 10065 Location: Germany
|
Posted: Fri Mar 09, 2007 2:21 am Post subject: |
|
|
Call Data>Define... and pick your range from the list. Below "More Options" you find an option "Insert/Remove Cells". _________________ Rest in peace, oooforum.org
Get help on http://forum.openoffice.org |
|
| Back to top |
|
 |
noranthon Super User

Joined: 07 Jul 2005 Posts: 3318
|
Posted: Fri Mar 09, 2007 3:53 am Post subject: |
|
|
I'm not sure what you're after. If you want code to extend your data range by (a) row/s, this is what I use:
| Code: | Sub extDBRows
'extends the relevant database range by one row;
'requires previous definition of oExtDBase and lNum
Dim aDataArea as new com.sun.star.table.CellRangeAddress
oDBCells = oExtDBase.ReferredCells : iDBSheet = oDBCells.RangeAddress.Sheet
lDBLeft = oDBCells.RangeAddress.StartColumn : lDBTop = oDBCells.RangeAddress.StartRow
lDBRight = oDBCells.RangeAddress.EndColumn
lDBFoot = oDBCells.RangeAddress.EndRow + lNum
With aDataArea
.Sheet = iDBSheet
.StartColumn = lDBLeft
.StartRow = lDBTop
.EndColumn = lDBRight
.EndRow = lDBFoot
End With
oExtDBase.setDataArea( aDataArea )
End Sub |
_________________ search forum by month |
|
| Back to top |
|
 |
heymish General User


Joined: 08 Mar 2007 Posts: 5 Location: Christchurch, New Zealand
|
Posted: Sun Mar 11, 2007 12:47 pm Post subject: |
|
|
I am getting information out of a query in Base and writing it into a Range in my Calc Sheet. I do not want to define the range to be masive to allow for all the data that could be there. I want to grow the Range as I need.
I have to print the Calc sheet out so I would like to keep it small.
Would it just be easier to change the print area in a macro.
Looks like the abovce code should do what I want. THanks |
|
| Back to top |
|
 |
heymish General User


Joined: 08 Mar 2007 Posts: 5 Location: Christchurch, New Zealand
|
Posted: Sun Mar 11, 2007 5:24 pm Post subject: |
|
|
Thanks the code was what I wanted worked well.
So now if the Range is too small for the data I am adding from Base it adds another Row to the Range and continues on. |
|
| Back to top |
|
 |
|