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

Copy or Repeat Data o Cell to Range

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
JoGaBar
General User
General User


Joined: 25 Oct 2007
Posts: 7

PostPosted: Mon May 26, 2008 8:20 am    Post subject: Copy or Repeat Data o Cell to Range Reply with quote

Hi:

I have program in Harbour (some like VFox) and need copy one data or cell repeat to Range, by examle:

Copy "Suc01" in A5:A5000


How can make this ?

Than

Jorge
Back to top
View user's profile Send private message
Tribio
General User
General User


Joined: 04 Dec 2007
Posts: 28
Location: Belgium

PostPosted: Wed May 28, 2008 1:58 am    Post subject: Reply with quote

Meaning something like this?

Code:
Dim   oDoc As Object
Dim   oSheet As Object
Dim   iCounter As Integer

Sub CopyTextToRange

   oDoc = ThisComponent
   oSheet = oDoc.Sheets(0)
   
   For iCounter = 4 to 4999
      oSheet.getCellByPosition(0, iCounter).Text = "Suc01"
   Next iCounter

End Sub
Back to top
View user's profile Send private message Visit poster's website
JoGaBar
General User
General User


Joined: 25 Oct 2007
Posts: 7

PostPosted: Wed May 28, 2008 6:06 am    Post subject: Reply with quote

Better like:


Copy "Suc01" to A4:A5000

Need Speed.

But, i not know how.


Regards
Back to top
View user's profile Send private message
Villeroy
Super User
Super User


Joined: 04 Oct 2004
Posts: 10106
Location: Germany

PostPosted: Wed May 28, 2008 6:17 am    Post subject: Reply with quote

Code:

sheet = thisComponent.Sheets.getByIndex(0)
sheet.getCellByPosition(0,0).setString("Suc01")
range = sheet.getCellRangeByPosition(0,0,0,4999)
range.fillSeries(com.sun.star.sheet.FillDirection.TO_BOTTOM,com.sun.star.sheet.FillMode.SIMPLE,0,0,0)

_________________
Rest in peace, oooforum.org
Get help on https://forum.openoffice.org
Back to top
View user's profile Send private message
Tommy27
OOo Advocate
OOo Advocate


Joined: 18 Nov 2006
Posts: 302

PostPosted: Sat Jul 09, 2011 10:26 pm    Post subject: Reply with quote

that was exactly what I was looking for.

If someone needs to set other coordinates must consider that A1 is (0,0), B1 is (1,0), C1 is (2,0) and so long...
Back to top
View user's profile Send private message
Tommy27
OOo Advocate
OOo Advocate


Joined: 18 Nov 2006
Posts: 302

PostPosted: Sun Aug 21, 2011 9:47 am    Post subject: Reply with quote

I just found out that you don't need macros to fill a column with repeated text.

You can use the "Fill" feature.

see here: http://wiki.services.openoffice.org/wiki/Documentation/OOo3_User_Guides/Calc_Guide/Speeding_up_data_entry
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 Macros and API 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