【问题标题】:LibreCalc Equivalent Function to Excel Application.InputBoxLibreCalc 等效函数到 Excel Application.InputBox
【发布时间】:2017-04-13 17:16:12
【问题描述】:

我最近转而使用 LibreCalc 而不是 MS Excel。我有一些我想在 LibreCalc 中使用的 Excel 宏,其中一些使用 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 中是否有等效的函数,或者是否有不同的方法可以手动选择一系列单元格并将其分配给参数,然后可以稍后在宏中调用?

【问题讨论】:

    标签: excel basic libreoffice-calc vba


    【解决方案1】:

    您可以在 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")
    

    【讨论】:

      猜你喜欢
      • 2016-09-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-09-23
      • 1970-01-01
      • 2012-06-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多