我在Excel中有一个VBA函数返回用户选择的单元格中的串联文本字符串。
这可以按照我的要求工作,但是如果选择中有隐藏的单元格,则包含隐藏单元格的值,这是不合需要的。发生此问题的一个示例是过滤表。
有没有办法修改我的函数来检查正在读取的单元格是否可见?
Sub ConcatEmialAddresses()
Dim EmailAddresses As String
ActiveSheet.Range("C3").Value = combineSelected()
ActiveSheet.Range("C3").Select
Call MsgBox("The email address string from cell ""C3"" has been copied to your clipboard.", vbOKOnly, "Sit back, relax, it's all been taken care of...")
End Sub
Function combineSelected(Optional ByVal separator As String = "; ", _
Optional ByVal copyText As Boolean = True) As String
Dim cellValue As Range
Dim outputText As String
For Each cellValue In Selection
outputText = outputText & cellValue & separator
Next cellValue
If Right(outputText, 2) = separator Then outputText = Left(outputText, Len(outputText) - 2)
combineSelected = outputText
End Function
答案 0 :(得分:1)
要确定Range是否有隐藏单元格,我会检查每行/列的高度/宽度是否与零不同:
$scope.submitForm = function() {
console.log('from submit')
$http({
url: 'http://127.0.0.1:8000/',
data: $scope.file,
method: 'POST',
headers: {
'X-CSRFToken': $cookies['csrftoken']}
})
}