Please can someone help me to work out how to change this macro so that both statements need to be true, rather than both running but bringing back results of both:
Sub CopyAtt1()
Application.ScreenUpdating = False
Application.StatusBar = "Please be patient..."
Worksheets("Sheet1").rows("25:5000").ClearContents
Dim bottomL As Integer
bottomL = Sheets("DB").Range("A" & rows.Count).End(xlUp).Row
Dim c As Range
For Each c In Sheets("DB").Range("A1:A" & bottomL)
If c.Value = Range("C5") Then
c.EntireRow.Copy Worksheets("Sheet1").Range("A" & rows.Count).End(xlUp).Offset(1)
End If
Next c
Dim d As Range
For Each d In Sheets("DB").Range("D1:D" & bottomL)
If d.Value = Range("E5") Then
d.EntireRow.Copy Worksheets("Sheet1").Range("A" & rows.Count).End(xlUp).Offset(1)
End If
Next d
Application.StatusBar = False
MsgBox "Update is now complete"
End Sub
Thanks.
Sub CopyAtt1()
Application.ScreenUpdating = False
Application.StatusBar = "Please be patient..."
Worksheets("Sheet1").rows("25:5000").ClearContents
Dim bottomL As Integer
bottomL = Sheets("DB").Range("A" & rows.Count).End(xlUp).Row
Dim c As Range
For Each c In Sheets("DB").Range("A1:A" & bottomL)
If c.Value = Range("C5") Then
c.EntireRow.Copy Worksheets("Sheet1").Range("A" & rows.Count).End(xlUp).Offset(1)
End If
Next c
Dim d As Range
For Each d In Sheets("DB").Range("D1:D" & bottomL)
If d.Value = Range("E5") Then
d.EntireRow.Copy Worksheets("Sheet1").Range("A" & rows.Count).End(xlUp).Offset(1)
End If
Next d
Application.StatusBar = False
MsgBox "Update is now complete"
End Sub
Thanks.