Hi,
Apologies if this is in the wrong forum, I am hoping someone can help me with a a query.
I am trying to copy a row from one tab within an excel spreadsheet to another tab within the same spreadsheet with certain conditions.
I have attached the spreadsheet 'IM Project.xlsm' so you can understand what i'm trying to do and hopefully help me.
I am trying to copy any row in the 'risk register' and 'issue register' tabs that have a value of 'red' in the level column (F) into the 'Project Dashboard' tab. So far i have managed to change some code I got from a similar example to copy them over to the Project dashboard tab which I have also made run on startup. The code i am using is:
Sheet3 (Risk Register)
Sub Risks()
Dim LT As Long, j As Long
LT = Range("A" & Rows.Count).End(xlUp).Row
For j = 2 To LT
If Range("F" & j).Value = "Red" Then Rows(j).Copy Destination:=Sheets("Project Dashboard").Range("A" & Rows.Count).End(xlUp).Offset(1)
Next j
End Sub
Sheet4 (Issue Register)
Sub Issues()
Dim LR As Long, i As Long
LR = Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To LR
If Range("F" & i).Value = "Red" Then Rows(i).Copy Destination:=Sheets("Project Dashboard").Range("A" & Rows.Count).End(xlUp).Offset(1)
Next i
End Sub
ThisWorkbook
Sub WorkBook_Open()
Call Sheet3.Risks
Call Sheet4.Issues
End Sub
What I am finding is that every time the code is run it adds the risks & issues to the list and keeps adding whereas i want it to show them once (sorry if this is unclear, finding it hard to explain). Also I would like to split them up and be able to define where they start on the screen, i.e. I would like the risks to start in B3 and the issues to start in B20.
Any help would be appreciated, FYI this is the first time I have ever used coding like this so please bear with me.
Thanks
Bookmarks