Try this codeCopy the Excel VBA code![]()
Option Explicit Sub update_status() Dim lrow As Long, i As Long, a As Long With Worksheets("Status") lrow = .Range("B" & .Rows.Count).End(xlUp).Row For i = 4 To lrow If .Range("B" & i).Value <> "Risk" Then .Range("B" & i).Value = "" End If Next i End With a = 4 With Worksheets("Issue Log") lrow = .Range("C" & .Rows.Count).End(xlUp).Row For i = 3 To lrow If .Range("G" & i).Value = "Open" And .Range("H" & i).Value = "Critical" Then If Worksheets("Status").Range("B" & a + 2).Value = "Risk" Then Worksheets("Status").Rows(a).Insert End If Worksheets("Status").Range("B" & a).Value = .Range("D" & i).Value a = a + 1 End If Next i End With With Worksheets("Status") lrow = .Range("B" & .Rows.Count).End(xlUp).Row For i = 4 To lrow If .Range("B" & i).Value = "Risk" Then a = i + 1 Exit For End If Next i End With With Worksheets("Risk Tracker") lrow = .Range("C" & .Rows.Count).End(xlUp).Row For i = 3 To lrow If .Range("G" & i).Value = "Critical" Then If Worksheets("Status").Range("B" & a + 1 & ":M" & a + 1).MergeCells = False Then Worksheets("Status").Rows(a).Insert End If Worksheets("Status").Range("B" & a).Value = .Range("D" & i).Value a = a + 1 End If Next i End With End Sub
Select the workbook in which you want to store the Excel VBA code
Hold the Alt key, and press the F11 key, to open the Visual Basic Editor
Choose Insert | Module
Where the cursor is flashing, choose Edit | Paste
To run the Excel VBA code:
Choose View | Macros
Select a macro in the list, and click the Run button
Couple of observations
1. Make all the updates to the Issue Log and Risk Tracker and then run the macro.
2. The conditions for the Issue Log are column G=Open and Column H=Critical.
3. The conditions for the Risk Tracker are column G=Critical
Let me know if anything needs to be changed.
Bookmarks