find方法的常見應用
Sub 查找并操作()
Dim arr
Set 日期標記單元格 = Cells.Find("出生日期", lookat:=xlWhole, searchorder:=xlRows)
If Not 日期標記單元格 Is Nothing Then
第一個找到符合內容的地址 = 日期標記單元格.Address
End If
Do While Not 日期標記單元格 Is Nothing
Set 日期單元格 = 日期標記單元格.Offset(0, 1)
arr = Split(日期單元格.Value, "/")
日期單元格.Value = arr(2) & "年" & arr(1) & "月" & arr(0) & "日"
Set 日期標記單元格 = Cells.Find("出生日期", after:=日期標記單元格)
If 日期標記單元格.Address = 第一個找到符合內容的地址 Then Exit Do
Loop
End Sub

浙公網安備 33010602011771號