绘制宏输出数组

问题描述

我正在尝试使用以下代码绘制来自不同工作表的多个单元格列表的输出

Option Explicit

Function MergeRanges(ParamArray arguments() As Variant) As Variant()
Dim cell As Range,temp() As Variant,argument As Variant
Dim iRows As Integer,i As Integer
ReDim temp(0)

For Each argument In arguments
  For Each cell In argument
    If cell <> "" Then
      temp(UBound(temp)) = cell
      ReDim Preserve temp(UBound(temp) + 1)
    End If
  Next cell
Next argument

ReDim Preserve temp(UBound(temp) - 1)
iRows = Range(Application.Caller.Address).Rows.Count
For i = UBound(temp) To iRows
  ReDim Preserve temp(UBound(temp) + 1)
  temp(UBound(temp)) = ""
Next i

MergeRanges = Application.Transpose(temp)

End Function

出于某种原因,当我尝试绘制组合来自其他工作表的单元格的数组时,图表没有在 X 轴上生成正确的值 - 它没有正确读取数组。例如,当我从下表(这是上述代码输出)中绘制累积盈亏与日期的图表时,XY 散点图绘制的日期轴不正确:

Table of output values - combined lists from other sheets

Chart showing incorrect date values on the x-axis

只是想知道是否有人知道这里可能存在什么问题?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)