OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Add Row to a Range

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc
View previous topic :: View next topic  
Author Message
heymish
General User
General User


Joined: 08 Mar 2007
Posts: 5
Location: Christchurch, New Zealand

PostPosted: Thu Mar 08, 2007 6:12 pm    Post subject: Add Row to a Range Reply with quote

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
View user's profile Send private message
Villeroy
Super User
Super User


Joined: 04 Oct 2004
Posts: 10106
Location: Germany

PostPosted: Fri Mar 09, 2007 2:21 am    Post subject: Reply with quote

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 https://forum.openoffice.org
Back to top
View user's profile Send private message
noranthon
Super User
Super User


Joined: 07 Jul 2005
Posts: 3318

PostPosted: Fri Mar 09, 2007 3:53 am    Post subject: Reply with quote

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
View user's profile Send private message
heymish
General User
General User


Joined: 08 Mar 2007
Posts: 5
Location: Christchurch, New Zealand

PostPosted: Sun Mar 11, 2007 12:47 pm    Post subject: Reply with quote

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
View user's profile Send private message
heymish
General User
General User


Joined: 08 Mar 2007
Posts: 5
Location: Christchurch, New Zealand

PostPosted: Sun Mar 11, 2007 5:24 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group