user_v1
12-28-2021, 12:26 PM
Hi,
i have a macro that reads a selection in a (open) word file
and i want to find this selection in the 2nd column of a worksheet
and copy the cell value of the 4th column (same row).
I've tried several methods with no success.
I ask for your help for the [find] section and the selection of the cell in 4th column.
This reads all cells in the 2nd column but doesn't find the string from Word (r) that exists in 10th row.
With wb.Sheets("new_prices").Range("b1") '<--------------------- wb is the open excel file
For idx = 1 To .CurrentRegion.Rows.Count
With Selection.Find
.Forward = True
.ClearFormatting
.MatchWholeWord = False
.MatchCase = False
.Wrap = wdFindContinue
.Text = r '<-------------------------------------- string from Word
If .Execute = True Then
..............................
..............................
End If
End With
Next
End With
Thanks
i have a macro that reads a selection in a (open) word file
and i want to find this selection in the 2nd column of a worksheet
and copy the cell value of the 4th column (same row).
I've tried several methods with no success.
I ask for your help for the [find] section and the selection of the cell in 4th column.
This reads all cells in the 2nd column but doesn't find the string from Word (r) that exists in 10th row.
With wb.Sheets("new_prices").Range("b1") '<--------------------- wb is the open excel file
For idx = 1 To .CurrentRegion.Rows.Count
With Selection.Find
.Forward = True
.ClearFormatting
.MatchWholeWord = False
.MatchCase = False
.Wrap = wdFindContinue
.Text = r '<-------------------------------------- string from Word
If .Execute = True Then
..............................
..............................
End If
End With
Next
End With
Thanks