I am using a lookup on part numbers that can begin with a zero. In order for this to work the numbers have to be formatted as text. For some reason though I can not get my macro to work correctly. The following lookup returns "#N/A" although I have formatted the numbers to text in both sheets where the numbers appear. I find that if I stop the macro, go into the number in the cell and reenter it, the formula works.
Range(Cells(2, 1), Cells(lastrow, 2)).NumberFormat = "@" 'for text formating
With Range("R2").Resize(lastrow - 1)
.Offset.Formula = "=VLOOKUP(B2,'MIX PREVIOUS'!B:R,17,FALSE)"
.Offset.Copy
.Offset.Select
.Offset.PasteSpecial Paste:=xlPasteValues
.Offset.Application.CutCopyMode = False
End With
Help please!
Range(Cells(2, 1), Cells(lastrow, 2)).NumberFormat = "@" 'for text formating
With Range("R2").Resize(lastrow - 1)
.Offset.Formula = "=VLOOKUP(B2,'MIX PREVIOUS'!B:R,17,FALSE)"
.Offset.Copy
.Offset.Select
.Offset.PasteSpecial Paste:=xlPasteValues
.Offset.Application.CutCopyMode = False
End With
Help please!