我想在包含特定字符串的工作表中找到一个单元格。
我不确切地知道电子表格中会有多少列或行,因此我想用CurrentRegion
来完成它。
这就是我的尝试:
=FIND("Data String", Range("A1").CurrentRegion)
答案 0 :(得分:5)
您应该查看Microsoft参考资料:Range.Find Method (Excel)。
.Find(What, After, LookIn, LookAt, SearchOrder, SearchDirection, MatchCase, MatchByte, SearchFormat)
示例:
Dim rngFound as Range
With Worksheets("MySheetName").Cells
Set rngFound = .Find("MySearchString", LookIn:=xlValues)
If Not rngFound Is Nothing Then
'something is found
else
'nothing found
End If
End With
搜索整个表格
答案 1 :(得分:1)
试试这个
Cell
----------这会选择inputbox
范围内的下一个Sub Find_First()
Dim FindString As String
Dim Rng As Range
FindString = InputBox("Enter a Search value")
If Trim(FindString) <> "" Then
With Sheets("Sheet1").Range("A:A")
Set Rng = .Find(What:=FindString, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not Rng Is Nothing Then
Application.Goto Rng, True
Else
MsgBox "Nothing found"
End If
End With
End If
End Sub
$rootScope.pagename = [];
$scope.myFunc= function(event)
{
$rootScope.pagename.push(event.target.id);
};