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!
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