Hello everyone,
I've been trying for days to copy filtered data from one sheet to another. My code works fine but I am only getting the visible rows copied to the new sheet. The hidden columns contain information I need n the ew sheet.
Can anyone help me?
Here is my code:
Sub RequestApproval()
Dim lr As Long, lr2 As Long, lr3 As Long, lr4 As Long, lr5 As Long, r As Long
lr = Sheets("Intake Plan").Cells(Rows.Count, "A").End(xlUp).Row
lr2 = Sheets("Brian").Cells(Rows.Count, "A").End(xlUp).Row
lr3 = Sheets("Wes").Cells(Rows.Count, "A").End(xlUp).Row
lr4 = Sheets("Dustin").Cells(Rows.Count, "A").End(xlUp).Row
lr5 = Sheets("Brandon").Cells(Rows.Count, "A").End(xlUp).Row
For r = lr To 2 Step -1
Select Case Range("AJ" & r).Value
Case Is = "Yes-Brian"
Rows(r).Copy Destination:=Sheets("Brian").Range("A" & lr2 + 1)
lr2 = Sheets("Brian").Cells(Rows.Count, "A").End(xlUp).Row
Rows(r).Delete
Case Is = "Yes-Wes"
Rows(r).Copy Destination:=Sheets("Wes").Range("A" & lr3 + 1)
lr3 = Sheets("Wes").Cells(Rows.Count, "A").End(xlUp).Row
Rows(r).Delete
Case Is = "Yes-Dustin"
Rows(r).Copy Destination:=Sheets("Dustin").Range("A" & lr4 + 1)
lr4 = Sheets("Dustin").Cells(Rows.Count, "A").End(xlUp).Row
Rows(r).Delete
Case Is = "Yes-Brandon"
Rows(r).Copy Destination:=Sheets("Brandon").Range("A" & lr5 + 1)
lr5 = Sheets("Brandon").Cells(Rows.Count, "A").End(xlUp).Row
Rows(r).Delete
End Select
Next r
End Sub
I've been trying for days to copy filtered data from one sheet to another. My code works fine but I am only getting the visible rows copied to the new sheet. The hidden columns contain information I need n the ew sheet.
Can anyone help me?
Here is my code:
Sub RequestApproval()
Dim lr As Long, lr2 As Long, lr3 As Long, lr4 As Long, lr5 As Long, r As Long
lr = Sheets("Intake Plan").Cells(Rows.Count, "A").End(xlUp).Row
lr2 = Sheets("Brian").Cells(Rows.Count, "A").End(xlUp).Row
lr3 = Sheets("Wes").Cells(Rows.Count, "A").End(xlUp).Row
lr4 = Sheets("Dustin").Cells(Rows.Count, "A").End(xlUp).Row
lr5 = Sheets("Brandon").Cells(Rows.Count, "A").End(xlUp).Row
For r = lr To 2 Step -1
Select Case Range("AJ" & r).Value
Case Is = "Yes-Brian"
Rows(r).Copy Destination:=Sheets("Brian").Range("A" & lr2 + 1)
lr2 = Sheets("Brian").Cells(Rows.Count, "A").End(xlUp).Row
Rows(r).Delete
Case Is = "Yes-Wes"
Rows(r).Copy Destination:=Sheets("Wes").Range("A" & lr3 + 1)
lr3 = Sheets("Wes").Cells(Rows.Count, "A").End(xlUp).Row
Rows(r).Delete
Case Is = "Yes-Dustin"
Rows(r).Copy Destination:=Sheets("Dustin").Range("A" & lr4 + 1)
lr4 = Sheets("Dustin").Cells(Rows.Count, "A").End(xlUp).Row
Rows(r).Delete
Case Is = "Yes-Brandon"
Rows(r).Copy Destination:=Sheets("Brandon").Range("A" & lr5 + 1)
lr5 = Sheets("Brandon").Cells(Rows.Count, "A").End(xlUp).Row
Rows(r).Delete
End Select
Next r
End Sub