Hi, I have looked but I am so new to this I don't have much of a clue if it doesn't relate to the code I have which is below.
I want to copy Columns A to BR in to the MG sheet if BR has a Y in it.
Ideally I would love to have something which would look up a range of columns in the Master Data sheet then copy in to the relevant sheet. I hope I have made some sense!
Code
Sub MoveRowBasedOnCellValueMGM()
Dim xRg As Range
Dim xCell As Range
Dim I As Long
Dim J As Long
Dim K As Long
I = Worksheets("Master data").UsedRange.Rows.Count
J = Worksheets("MG").UsedRange.Rows.Count
If J = 1 Then
If Application.WorksheetFunction.CountA(Worksheets("MG").UsedRange) = 0 Then J = 0
End If
Set xRg = Worksheets("Master data").Range("BR2:BR" & I)
On Error Resume Next
Application.ScreenUpdating = False
For K = 1 To xRg.Count
If CStr(xRg(K).Value) = "Y" Then
xRg(K).Copy range("A:BP").Copy Destination:=Worksheets("MG").Range("A" & J + 1)
J = J + 1
End If
Next
Application.ScreenUpdating = True
End Sub
Display More