Creating a New Sheet with all relevant data from a different table.

steveh8204

Board Regular
Joined
Aug 20, 2018
Messages
143
Hi,

is it possible to create code to go through a table and if a value is met transfer the whole contents of the row into a new sheet totalling all relevant values.

For example creating a sheet with all the row information for every row that has the value in Column F higher than 0?

Thanks in advance.
 
Try:
Code:
Sub CopyData()
    Application.ScreenUpdating = False
    Dim LastRow As Long, srcWS As Worksheet
    Set srcWS = Sheets("SAP")
    With srcWS
        LastRow = .Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
        .Range("F1:F" & LastRow).AutoFilter Field:=1, Criteria1:="<>0", Criteria2:="<>"
        .Range("F2:F" & LastRow).SpecialCells(xlCellTypeVisible).EntireRow.Copy Sheets("Issues").Cells(Sheets("Issues").Rows.Count, "A").End(xlUp).Offset(1, 0)
        .Range("F1").AutoFilter
    End With
    Application.ScreenUpdating = True
End Sub

Works like a dream, thanks very much!
 
Upvote 0

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

Forum statistics

Threads
1,216,109
Messages
6,128,880
Members
449,477
Latest member
panjongshing

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