本文介绍了如何使用Excel公式引用从一个工作表到另一个工作表的单元格范围?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个包含工作表Sheet1和Sheet2的工作表,我正在尝试引用从Sheet2到Sheet1的单元格范围.
I have a single worksheet with sheets Sheet1 and Sheet2 and I am trying to reference a range of cells from Sheet2 to Sheet1
我知道如何引用工作表单元格(例如=Sheet2!A1
),但是如何对尝试使用=Sheet2!A1:F1
的A1:F1
这样的单元格区域进行相同操作,但是它不喜欢语法.
I know how to reference worksheet cells such as =Sheet2!A1
but how can I do the same for a cell range such as A1:F1
I tried =Sheet2!A1:F1
but it does not like the syntax.
如果可能,我需要为此使用Excel公式.
I need to use Excel Formulas for this if possible.
推荐答案
好了,我下载了一个自定义的串联函数,然后引用了它的单元格
Ok Got it, I downloaded a custom concatenation function and then just referenced its cells
代码
Function concat(useThis As Range, Optional delim As String) As String
' this function will concatenate a range of cells and return one string
' useful when you have a rather large range of cells that you need to add up
Dim retVal, dlm As String
retVal = ""
If delim = Null Then
dlm = ""
Else
dlm = delim
End If
For Each cell In useThis
if cstr(cell.value)<>"" and cstr(cell.value)<>" " then
retVal = retVal & cstr(cell.Value) & dlm
end if
Next
If dlm <> "" Then
retVal = Left(retVal, Len(retVal) - Len(dlm))
End If
concat = retVal
End Function
这篇关于如何使用Excel公式引用从一个工作表到另一个工作表的单元格范围?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!