Workproject VBA Marco Help!

Xineq

New Member
Joined
Aug 29, 2014
Messages
34
Hey MrExcel
I am new to VBA, and would like to ease my workload a bit by adding a VBA Marco to do some the boring part. I want to make a marco thats search the active worksheet for some specific names (around 5, more can be added, and will always be standing in column G) and then copy the rows with the specific names to another sheet named (Overview). I normally uses a pivot table to do this, i dont know if VBA have probs with that?

I hope you can help me out :)
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Hi

Assuming you put your list of names in column A of a sheet called 'List', and that your target sheet is called 'Target Sheet', and that you want to begin copying your rows in row 1 (otherwise you can amend any of those details in the code), the following should work:

Code:
Sub Move()
    Application.ScreenUpdating = False
    n = Cells(Rows.Count, 7).End(xlUp).Row
    k = 1
    For r = 1 To n
        If Evaluate("COUNTIF(List!A:A,""" & Cells(r, 7) & """)") > 0 Then
            Rows(r).Copy
            Sheets("Target Sheet").Rows(k).Insert
            k = k + 1
        End If
    Next
    Application.CutCopyMode.false
    Application.ScreenUpdating = True
End Sub
Hope this helps,

Chris.
 
Upvote 0
Thanks for the help :) Just had to change somethings and now its working the way i wanted it to thanks alot :)
 
Upvote 0

Forum statistics

Threads
1,214,808
Messages
6,121,684
Members
449,048
Latest member
81jamesacct

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