VBA Macro to copy values on other sheet based on condition

mcane

New Member
Joined
Jun 5, 2017
Messages
4
Hi People!
Sorry i'm very basic with macros, I have a vague idea but to be honest the last time I've done one was 8 years ago.
I think this might be simple, but I can't do it, so it would be really helpful if you guys can help me ;)
I have a file with 2 sheets, one called "Recommendation Table" and the other "Close Out Plan"
So, I need to populate all the information from the "Recommendation Table" sheet into the "Close Out Plan" based on the value of the D Column of the "Recommendation Table" (if Column D=Critical or Essential, then I'd need to copy all the row, otherwise I need to check the next row).

Thanks in advance to everyone.
Miguel.
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Try this:
Code:
Sub My_Filter()
Dim ans1 As String
Dim ans2 As String
ans1 = "Critical"
ans2 = "Essential"
    With Sheets("Recommendation Table").UsedRange
        .AutoFilter
        .AutoFilter Field:=4, Criteria1:=Array(ans1, ans2), Operator:=xlFilterValues
        .SpecialCells(xlCellTypeVisible).Copy Worksheets("Close Out Plan").Range("A1")
        .AutoFilter
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,706
Messages
6,173,998
Members
452,542
Latest member
Bricklin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top