I’m writing a BASIC function in Calc and have a variable containing a cell range using the following code:
dataSheet = ThisComponent.Sheets.getByName("Materials")
componentList = dataSheet.getCellRangeByName("Components")
componentNames = dataSheet.getCellRangeByName("ComponentNames")
componentList
is a 2D block of cells that I later use VLOOKUP to access data contained in this range.
This range has a lot of empty rows, reserved for future data, after the populated data section finishes.
componentNames
overlays componentList
but only references the first column (i.e. the keys).
Want I want to do is search componentNames
for the first empty cell, record its address, and then populate that row with new data. I’m stuck on some code which is giving me a Data Type Mismatch
error for reasons I am unable to work out.
For Each c in componentNames.AbsoluteName()
IF c.value = "" Then
MsgBox "No value in " & c.range
END IF
NEXT
I’m assuming that I’m not invoking either the right method or accessing the correct property of componentNames
but since there’s no auto-completion in Calc, I have no idea what is required here.
Searching this forum, and others, hasn’t helped on this occasion.
I also suspect that once I figure this out, I will not need the overlayed range as I will be able to iterate through the first column of componentList
.