'problems with application.match strings and numbers
I have tried to search and find out why or how to fix this problem.
I have a code that compares values between w1 and w2 and then copy a value from w2 to w1. But it only work when the cell in w1 is a string, not when a number is stored as a string. Hope you understand my problem.
Sub UpdateGPL(sheet, cl, ofs)
'sheet = Sheet, cl = column from, ofs = ofset
Dim w1 As Worksheet, w2 As Worksheet
Dim c As Range, FR As Variant
Application.ScreenUpdating = False
Set w1 = Sheets(sheet)
Set w2 = Sheets("GPL")
w1.Select
For Each c In w1.Range("A2", w1.Range("A" & Rows.Count).End(xlUp))
FR = Application.Match(c, w2.Columns("C"), 0)
If IsNumeric(FR) Then c.Offset(, ofs).Value = w2.Range(cl & FR).Value
Next c
Application.ScreenUpdating = True
End Sub
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
