VBA 查找特定单词并将值复制到另一个单元格

VBA to find specific word and copy value to another cell

我正在寻求有关 vba 的帮助。

我想在 A 列中搜索 "Summary of CAMBUSLANG",如果找到,则将 D 列中的值分配给另一个单元格以供讨论,比如另一个电子表格的 A 列。

如有任何帮助,我们将不胜感激。

使用Range.Find Method to find your specific string in column A and the Range.Offset Property移动到D列:

Option Explicit

Public Sub Example()
    Dim FoundAt As Range
    Set FoundAt = Worksheets("SearchSheet").Columns("A").Find(What:="Summary of CAMBUSLANG", LookIn:=xlValues, LookAt:=xlWhole)

    If Not FoundAt Is Nothing Then 
        Worksheets("AnotherSheet").Range("A1").Value = FoundAt.Offset(ColumnOffset:=3).Value
    Else 'nothing found
        MsgBox "'Summary of CAMBUSLANG' not found.", vbCritical
    End If
End Sub