PDA

View Full Version : Solved: Sort Data Help



john3j
05-19-2009, 11:29 AM
Hello guys, I am in need of help. I have a workbook with 5 sheets. I have used the following code to color code some date depending what is in column 30:


For rw = LastRow To 2 Step -1
If Cells(rw, 3).Value <= "08" Or InStr(Cells(rw, 30).Value, "*If chosen") > 0 Then
Cells(rw, 1).EntireRow.delete
Else
Select Case Cells(rw, 30).Value
Case "Contract Awarded"
Rows(rw).Interior.ColorIndex = 35
Rows(rw).Font.ColorIndex = 1
Rows(rw).Borders.LineStyle = xlContinuous
Case "Part A Held"
Rows(rw).Interior.ColorIndex = 34
Rows(rw).Font.ColorIndex = 1
Rows(rw).Borders.LineStyle = xlContinuous
Case "Part B Accepted"
Rows(rw).Interior.ColorIndex = 38
Rows(rw).Font.ColorIndex = 1
Rows(rw).Borders.LineStyle = xlContinuous
Case "Part B Submitted"
Rows(rw).Interior.ColorIndex = 36
Rows(rw).Font.ColorIndex = 1
Rows(rw).Borders.LineStyle = xlContinuous
Case "Planning"
Rows(rw).Interior.ColorIndex = 2
Rows(rw).Font.ColorIndex = 1
Rows(rw).Borders.LineStyle = xlContinuous
Case "Postponed"
Rows(rw).Interior.ColorIndex = 39
Rows(rw).Font.ColorIndex = 1
Rows(rw).Borders.LineStyle = xlContinuous
End Select
Set ws = Sheets(Cells(rw, 3).Text)
'Check for next vacant cell
Set tgt = ws.Cells(Rows.Count, 3).End(xlUp).Offset(1, -2)
'Copy and paste data
'CUT and paste data
Cells(rw, 1).Resize(, 33).Cut tgt
End If


I need it to do the color coding from the main page "Sort Data" but when it sorts, if the value for each row in column "N" is equal to "Special Basic" then it should cut all of those rows and paste them into the page labeled "Dept. Special Basic". Everything else left from the main page should be dumped into the page labeled "Dept. Master".
I would like everything to color code exactly as the code did before, just change the way and where is pastes the data. On Both pages labeled "Special Basic" and "Dept. Master" I would like it to sort all of the rows while pasting depending on the value in column "C". For example, for all of the rows that have "09" in column "C", all of them should be pasted first, then all with "10" grouped together, and so on. I dont know if you could put a seperator in like in row 2 of the sheet labeled "Dept. Master" between each of the different groups. If anyone could help me acheive this it would be greatly appreciated. I will paste the data into the sheet labeled "Sharepoint Data". From there it should be color coded just like the code above suggests, and then cut and paste into the respective sheets depending on what is in column "N". I would just like to change the way it pastes the data if posssible. Thank you so much.