I'm not sure what the name of this thread should have been.
I have a document which has vlookups.
In cell A14; =IFERROR(VLOOKUP($G$7,'FULL LIST'!B2:L203,2,FALSE),"")
This formula runs down to cell A39.
When I change cell G7 to a different value, it is populates cells with repeated info.
I tried to put this VBA to remedy it but it does not work.
Private Sub Worksheet_Change(ByVal Target As Range)
' Check if the changed cell is G7
If Not Intersect(Target, Me.Range("G7")) Is Nothing Then
' Clear the target cells
Me.Range("A14, B14, D14, F14").ClearContents
' Re-apply VLOOKUP formulas to the target cells
Me.Range("A14").Formula = "=IFERROR(VLOOKUP($G$7,'FULL LIST'!B2:L203,2,FALSE), """")"
Me.Range("B14").Formula = "=IFERROR(VLOOKUP($G$7,'FULL LIST'!B2:L203,3,FALSE), """")"
Me.Range("D14").Formula = "=IFERROR(VLOOKUP($G$7,'FULL LIST'!B2:L203,8,FALSE), """")"
Me.Range("F14").Formula = "=IFERROR(VLOOKUP($G$7,'FULL LIST'!B2:L203,6,FALSE), """")"
End If
End Sub
any suggestions?
I have a document which has vlookups.
In cell A14; =IFERROR(VLOOKUP($G$7,'FULL LIST'!B2:L203,2,FALSE),"")
This formula runs down to cell A39.
When I change cell G7 to a different value, it is populates cells with repeated info.
I tried to put this VBA to remedy it but it does not work.
Private Sub Worksheet_Change(ByVal Target As Range)
' Check if the changed cell is G7
If Not Intersect(Target, Me.Range("G7")) Is Nothing Then
' Clear the target cells
Me.Range("A14, B14, D14, F14").ClearContents
' Re-apply VLOOKUP formulas to the target cells
Me.Range("A14").Formula = "=IFERROR(VLOOKUP($G$7,'FULL LIST'!B2:L203,2,FALSE), """")"
Me.Range("B14").Formula = "=IFERROR(VLOOKUP($G$7,'FULL LIST'!B2:L203,3,FALSE), """")"
Me.Range("D14").Formula = "=IFERROR(VLOOKUP($G$7,'FULL LIST'!B2:L203,8,FALSE), """")"
Me.Range("F14").Formula = "=IFERROR(VLOOKUP($G$7,'FULL LIST'!B2:L203,6,FALSE), """")"
End If
End Sub
any suggestions?