Need Help with a Macro

ASHMANT

New Member
Joined
Mar 12, 2012
Messages
1
I have created a spreadsheet with different sheets, I was wanting to be able to click the button I have added and for it to search all pages in column E, then if the number in a cell in column E is above 0, I want it to copy the corresponding row into a section on the first sheet. If you click here you will be able to download my file and see what I mean a bit better.

I am really stuck and this is a part of my University coursework, I would be really appreciative if someone can help me out with this.

Cheers
Ashley Manterfield
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Welcome to the Board!

You'll get a lot more response if you post whatever code you might have, instead of an external link, as a lot of people here either won't or can't access external file sharing sites. If you check the HTML Maker link in my sig you'll be able to post a shot of your sheet(s) as well.

I'd recommend starting with recording a macro finding at least one of the elements, then copy/pasting the row where you want. If you post back the recorded code, someone can help you set it up dynamically.
 
Upvote 0
assign the below code to the button:

Code:
Sub BuildReport()
    Dim ws As Worksheet
    
    For Each ws In Worksheets
        If ws.Name <> "Items Subtotal" Then
            ws.Range("A:F").AutoFilter field:=5, Criteria1:=">0"
            ws.AutoFilter.Range.Copy Worksheets("Items Subtotal").Range("A" & Worksheets("Items Subtotal").Range("A65000").End(xlUp).Row + 1)
            ws.AutoFilterMode = False
        End If
    Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,025
Messages
6,122,731
Members
449,093
Latest member
Mnur

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