LibreCalc 等价于 Excel Application.InputBox 的函数

LibreCalc Equivalent Function to Excel Application.InputBox

我最近转而使用 LibreCalc 而不是 MS Excel。我有许多 Excel 宏想在 LibreCalc 中使用,其中有几个使用 Application.InputBox 函数。我在 LibreCalc 中启用了 VBA 支持,但遗憾的是该功能无法识别。这是代码示例 -

Rem Attribute VBA_ModuleType=VBAModule
Option VBASupport 1
Sub Project_Data_Sort_By_Date()

Dim x As Long
Dim StartCont As Double
Dim EndCont As Double
Set R = Selection 'Select data range'
RowCnt = R.Rows.Count
colcnt = R.Columns.Count
Set TheTimes = Application.InputBox("Please enter time range: ", "User input", Type:=8) 'Times is corrected full data range of sample period'

在 MSExcel 中,type=8 的 Application.InputBox 函数会导致出现一个输入框,这将允许用户在输入框中输入一系列单元格。使用通常的 Basic InputBox 功能,无法输入单元格区域。

因此,LibreCalc 中是否有等效函数,或者是否有不同的方法可以手动 select 一系列单元格并将其分配给一个参数,然后可以稍后在宏?

您可以在 CALC 中使用相同的运行时函数:

range = Inputbox("Please enter time range:", "User input")
Times = ThisComponent.Sheets().getByIndex(0).getCellRangeByName(range)

您也可以将 range 作为字符串传递给该函数:

Times = ThisComponent.Sheets().getByIndex(0).getCellRangeByName("B2:C10")