Filtering, Sorting, and Copying Data to a New Location

Vertigoe

New Member
Joined
Jul 26, 2017
Messages
9
Hello,

I am trying to sort through an ever updating spreadsheet and give items a priority. Once the priority is given, I hit my Update command button to populate 5 priority tables (high, med. high, med, med. low, and low).

I feel like the below code should be correct for a single priority table, copying the priority number I have assigned in the proper cell, cycling through the master lists priority section, then copying all of the cells with the respective priority number.

I am not getting any errors, however nothing is copying over.

Any help would be huge.

Thanks!

Code:
Sub Prioritize()


Dim Priority As String
Dim finalRow As Long
Dim i As Integer


'Clear existing table data
Sheets("Sheet1").Range("J4:S50").ClearContents


'Set priority value to search for
Priority = Sheets("Sheet1").Range("L1").Value
'Find the final row of the master table
finalRow = Sheets("Sheet1").Range("D10000").End(xlUp).Row


'Sift through data from (D4) to the final row of the master table, _
    copy and paste the proper values into next available row
For i = 4 To finalRow
    If Cells(i, 4) = Priority Then
        Range(Cells(i, 2), Cells(i, 3)).Copy
        Range("L100").End(x1Up).Offset(1, 0).PasteSpecial xlPasteFormulasAndNumberFormats
        End If
Next i


Range("L1").Select


End Sub
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

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