Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Joining multiple ranges

Status
Not open for further replies.

Bong

Programmer
Dec 22, 1999
2,063
0
0
US
I'm trying to re-do all my formerly Excel tasks in LO-Calc. I'm in the process of making macros in OOBasic that I have had in VBA. I can do most of what I want although I don't really understand the whole Dispatcher thing and "star" and "uno" but whatever.

One thing I could do in VBA was specify a block of ranges like:
Code:
[b7:g38,h9:h37,i6:i12,i17:i23,j6:j21,k9:l37,m7:m37,o10:o19].ClearContents

But in OOBasic the best I could do is:
Code:
rng1=oSheet.getCellRangeByPosition(1,6,6,38)
rng1.clearContents(com.sun.star.sheet.CellFlags.STRING)
rng1.clearContents(com.sun.star.sheet.CellFlags.VALUE)
rng1=oSheet.getCellRangeByPosition(7,8,7,36)
rng1.clearContents(com.sun.star.sheet.CellFlags.STRING)
rng1.clearContents(com.sun.star.sheet.CellFlags.VALUE)
rng1=oSheet.getCellRangeByPosition(8,5,8,11)
rng1.clearContents(com.sun.star.sheet.CellFlags.STRING)
rng1.clearContents(com.sun.star.sheet.CellFlags.VALUE)
rng1=oSheet.getCellRangeByPosition(8,16,8,22)
rng1.clearContents(com.sun.star.sheet.CellFlags.STRING)
rng1.clearContents(com.sun.star.sheet.CellFlags.VALUE)
rng1=oSheet.getCellRangeByPosition(9,5,9,20)
rng1.clearContents(com.sun.star.sheet.CellFlags.STRING)
rng1.clearContents(com.sun.star.sheet.CellFlags.VALUE)
rng1=oSheet.getCellRangeByPosition(10,8,11,36)
rng1.clearContents(com.sun.star.sheet.CellFlags.STRING)
rng1.clearContents(com.sun.star.sheet.CellFlags.VALUE)
rng1=oSheet.getCellRangeByPosition(12,6,12,36)
rng1.clearContents(com.sun.star.sheet.CellFlags.STRING)
rng1.clearContents(com.sun.star.sheet.CellFlags.VALUE)

Is there a more compact way of doing this?

_________________
Bob Rashkin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top