amyloustafford
New Member
- Joined
- Jun 22, 2017
- Messages
- 1
Hi all
I'm hoping you can offer some advice please!! I have googled as much as I can to get to this point. I have a workbook, and I would like some coding that identifies if a contract is a "Contract - Framework" AND has a status of "Contract Awarded" on the "Procurement Tracker" tab. I would then like the relevant rows that meet this criteria to be copied over to another tab called "Live Contracts" and hidden on the original Procurement Tracker tab.
This is the formula I have so far that will move the rows that meet the "Contract - Framework" criteria, I would just like to know how to amend it so that the row meets both conditions;
Sub ReqToLive()
Dim xRg As Range
Dim xCell As Range
Dim I As Long
Dim J As Long
I = Worksheets("Procurement Tracker").UsedRange.Rows.Count
J = Worksheets("Live Contracts").UsedRange.Rows.Count
If J = 1 Then
If Application.WorksheetFunction.CountA(Worksheets("Live Contracts").UsedRange) = 0 Then J = 0
End If
Set xRg = Worksheets("Procurement Tracker").Range("F1:F" & I)
On Error Resume Next
Application.ScreenUpdating = False
For Each xCell In xRg
If CStr(xCell.Value) = "Contract - Framework" Then
xCell.EntireRow.Copy Destination:=Worksheets("Live Contracts").Range("A" & J + 1)
xCell.EntireRow.Hidden = True
J = J + 1
End If
Next
Application.ScreenUpdating = True
End Sub
Hope that makes sense! Thanks in advance
Amy
I'm hoping you can offer some advice please!! I have googled as much as I can to get to this point. I have a workbook, and I would like some coding that identifies if a contract is a "Contract - Framework" AND has a status of "Contract Awarded" on the "Procurement Tracker" tab. I would then like the relevant rows that meet this criteria to be copied over to another tab called "Live Contracts" and hidden on the original Procurement Tracker tab.
This is the formula I have so far that will move the rows that meet the "Contract - Framework" criteria, I would just like to know how to amend it so that the row meets both conditions;
Sub ReqToLive()
Dim xRg As Range
Dim xCell As Range
Dim I As Long
Dim J As Long
I = Worksheets("Procurement Tracker").UsedRange.Rows.Count
J = Worksheets("Live Contracts").UsedRange.Rows.Count
If J = 1 Then
If Application.WorksheetFunction.CountA(Worksheets("Live Contracts").UsedRange) = 0 Then J = 0
End If
Set xRg = Worksheets("Procurement Tracker").Range("F1:F" & I)
On Error Resume Next
Application.ScreenUpdating = False
For Each xCell In xRg
If CStr(xCell.Value) = "Contract - Framework" Then
xCell.EntireRow.Copy Destination:=Worksheets("Live Contracts").Range("A" & J + 1)
xCell.EntireRow.Hidden = True
J = J + 1
End If
Next
Application.ScreenUpdating = True
End Sub
Hope that makes sense! Thanks in advance
Amy