VBA Coding

Toncar58

New Member
Joined
Feb 24, 2021
Messages
30
Office Version
  1. 365
Platform
  1. MacOS
Hi
Can anyone help me with the VBA coding needed to move data on a worksheet that meets a "yes" in a column on image one to a new worksheet. I would like to use the "button" option on the From worksheet to automatically move all the "yes" data.

Hope this makes sense - Thanks
 

Attachments

  • Screenshot 2021-05-26 at 12.33.06.png
    Screenshot 2021-05-26 at 12.33.06.png
    53.6 KB · Views: 6
  • Screenshot 2021-05-26 at 12.33.14.png
    Screenshot 2021-05-26 at 12.33.14.png
    13.1 KB · Views: 6

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Hello Toncar,

I can't tell where your data starts in the source sheet so I've assumed:-

- Sheet1 is the source sheet with data starting in row2 and headings in row1.
- Sheet2 is the destination sheet with headings in row1.
- Columns are A:E.

This code, assigned to your button, should work based on the assumptions:-

VBA Code:
Sub Test()

Application.ScreenUpdating = False

        With Sheet1.[A1].CurrentRegion
                .AutoFilter 5, "Yes"
                .Offset(1).EntireRow.Copy Sheet2.Range("A" & Rows.Count).End(3)(2)
                .AutoFilter
        End With

Application.ScreenUpdating = True

End Sub

I hope that this helps.

Cheerio,
vcoolio.
 
Upvote 0
Hello Toncar,

I can't tell where your data starts in the source sheet so I've assumed:-

- Sheet1 is the source sheet with data starting in row2 and headings in row1.
- Sheet2 is the destination sheet with headings in row1.
- Columns are A:E.

This code, assigned to your button, should work based on the assumptions:-

VBA Code:
Sub Test()

Application.ScreenUpdating = False

        With Sheet1.[A1].CurrentRegion
                .AutoFilter 5, "Yes"
                .Offset(1).EntireRow.Copy Sheet2.Range("A" & Rows.Count).End(3)(2)
                .AutoFilter
        End With

Application.ScreenUpdating = True

End Sub

I hope that this helps.

Cheerio,
vcoolio.
Thank you so much vcoolio, I will try this and let you know. I could upload a pic of the entire page so had to do a limited screenshot. Until later Ciao
 
Upvote 0

Forum statistics

Threads
1,214,962
Messages
6,122,482
Members
449,088
Latest member
Melvetica

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