Mohamedazees
New Member
- Joined
- Oct 18, 2020
- Messages
- 45
- Office Version
- 2019
- Platform
- Windows
Dear Sir,
I need to popup the formula if I entir the ID in Cell F29 then G20 will popup the Formula if F29 is blank then G29 will become Blank , However I written the below macro but it is not solve my issue please help me to resolve my problem
The Code is below:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect([G20:R29], Target) Is Nothing Then
Application.EnableEvents = False
Dim cell As Range
For Each cell In Range("F20:F29")
If cell.Value > "" Then
'If cell.Offset(0, 1).Value = "" Then
cell.Offset(0, 1).Value = "=IFERROR(INDEX(Items!$B:$B,MATCH(" & cell.Address & ",Items!$A:$A,0)),0)"
'End If
If cell.Offset(0, 2).Value = "" Then
cell.Offset(0, 2).Value = "=IFERROR(INDEX(Items!$D:$D,MATCH(" & cell.Address & ",Items!$A:$A,0)),0)"
End If
If cell.Offset(0, 3).Value = "" Then
cell.Offset(0, 3).Value = "=IFERROR(INDEX(Items!$E:$E,MATCH(" & cell.Address & ",Items!$A:$A,0)),0)"
End If
If cell.Offset(0, 4).Value = "" Then
cell.Offset(0, 5).Value = "=IFERROR(INDEX(Items!$C:$C,MATCH(" & cell.Address & ",Items!$A:$A,0)),0)"
End If
End If
Next cell
End If
End Sub
I need to popup the formula if I entir the ID in Cell F29 then G20 will popup the Formula if F29 is blank then G29 will become Blank , However I written the below macro but it is not solve my issue please help me to resolve my problem
The Code is below:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect([G20:R29], Target) Is Nothing Then
Application.EnableEvents = False
Dim cell As Range
For Each cell In Range("F20:F29")
If cell.Value > "" Then
'If cell.Offset(0, 1).Value = "" Then
cell.Offset(0, 1).Value = "=IFERROR(INDEX(Items!$B:$B,MATCH(" & cell.Address & ",Items!$A:$A,0)),0)"
'End If
If cell.Offset(0, 2).Value = "" Then
cell.Offset(0, 2).Value = "=IFERROR(INDEX(Items!$D:$D,MATCH(" & cell.Address & ",Items!$A:$A,0)),0)"
End If
If cell.Offset(0, 3).Value = "" Then
cell.Offset(0, 3).Value = "=IFERROR(INDEX(Items!$E:$E,MATCH(" & cell.Address & ",Items!$A:$A,0)),0)"
End If
If cell.Offset(0, 4).Value = "" Then
cell.Offset(0, 5).Value = "=IFERROR(INDEX(Items!$C:$C,MATCH(" & cell.Address & ",Items!$A:$A,0)),0)"
End If
End If
Next cell
End If
End Sub