Sub X()
'在A1:A10000中尋找"Excel"
Dim rngX As Range
Set rngX = Worksheets("Sheet1").Range("A1:A10000").Find("Excel", lookat:=xlPart)
If Not rngX Is Nothing Then
MsgBox "Found at " & rngX.Address
End If
End Sub
xlPart = looks at the text in the cell for any match.
xlWhole = looks at the entire/exact entry in the cell to see if it matches.
=ADDRESS(MATCH(" Excel*",$A$1:$A$100,0),1)
https://www.udemy.com/blog/excel-vba-find/
Find(What, After, LookIn, LookAt, SearchOrder, SearchDirection, MatchCase, MatchByte, SearchFormat)
LookAt (optional): xlWhole and xlPart
LookIn (optional): xlFormulas.
SearchOrder(optional): xlByRows or xlByColumns
===============================================
Cells.Find(What:="24652", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False).Activate
'找不到時,會出現「 執行階段錯誤 91: 物件變數或 with 區塊變數未設定 」 的錯誤
'----------------------------------------------------------------------------------------------------------------
MsgBox Cells.Find(What:="24652", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False).Address
'找不到時,會出現「 執行階段錯誤 91: 物件變數或 with 區塊變數未設定 」 的錯誤
===============================================
searchstr = "123"
Set obj = Cells.Find(What:=searchstr, After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False)
If obj Is Nothing Then
MsgBox "找不到"
Else
MsgBox obj.Offset(3).Value '找到後,顯示向下3列的儲存格的資料值。
MsgBox obj.Address '顯示位址
MsgBox obj.Column '顯示行次(欄次)
MsgBox obj.Row '顯示列次
End If
====================================================
您好:
回覆刪除想請問板主
假設我今天有幾筆資料 因為我的資料輸出為115ms 所以一秒會有八筆資料
A欄 B欄 C欄 D欄
2017/5/5 12:00:12 12 13
2017/5/5 12:00:12 13 14
2017/5/5 12:00:12 14 15
2017/5/5 12:00:12 15 16
2017/5/5 12:00:12 12 13
2017/5/5 12:00:12 13 14
2017/5/5 12:00:12 14 15
2017/5/5 12:00:12 15 16
2017/5/5 12:00:13 16 17
2017/5/5 12:00:12 17 18
.
.
.
有沒有辦法利用表單 輸入欄位 填入日期與時間 就可以讀取到C和D欄的值 再將二值做計算
但我的一秒會有八筆 可以抓取到任一筆做計算就好嗎
例如 輸入2017/5/5 12:00:12
12+13
輸出結果25
麻煩板主了