JSR1306
New Member
- Joined
- Sep 15, 2012
- Messages
- 45
Hi all,
I am sorry if this has been explained already but I cant find anything that quite does what I want.
Basically I have a table as follows with about 1000 lines of data.
[TABLE="width: 100, align: center"]
<tbody>[TR]
[TD]Reference[/TD]
[TD]Priority[/TD]
[TD]status[/TD]
[TD]description[/TD]
[TD]due date[/TD]
[TD]date submitted[/TD]
[/TR]
[TR]
[TD]123[/TD]
[TD]2[/TD]
[TD]Open[/TD]
[TD]abc[/TD]
[TD]01/03/13[/TD]
[TD]11/02/13 [/TD]
[/TR]
[TR]
[TD]134[/TD]
[TD]2[/TD]
[TD]Open[/TD]
[TD]jhg[/TD]
[TD]02/03/13[/TD]
[TD]11/02/13[/TD]
[/TR]
[TR]
[TD]124[/TD]
[TD]1[/TD]
[TD]AWC [/TD]
[TD]kli[/TD]
[TD]01/03/13[/TD]
[TD]11/02/13[/TD]
[/TR]
[TR]
[TD]321[/TD]
[TD]3[/TD]
[TD]AWC[/TD]
[TD]ijk[/TD]
[TD]01/03/13[/TD]
[TD]11/02/13[/TD]
[/TR]
[TR]
[TD]526[/TD]
[TD]4[/TD]
[TD]Escalated[/TD]
[TD]yhu[/TD]
[TD]02/03/13[/TD]
[TD]11/02/13[/TD]
[/TR]
[TR]
[TD]981[/TD]
[TD]4[/TD]
[TD]Escalated[/TD]
[TD]jhy[/TD]
[TD]01/03/13[/TD]
[TD]11/02/13[/TD]
[/TR]
[TR]
[TD]852[/TD]
[TD]2[/TD]
[TD]Open[/TD]
[TD]abd[/TD]
[TD]01/03/13[/TD]
[TD]11/02/13[/TD]
[/TR]
</tbody>[/TABLE]
Basically I want to sort these into separate sheets under the headings of the status column. I have tried writing macros however this is very messy and I am sure there is a better way of coding it.
I have also tried some code such as the following:
Sub go()
Dim StsCol As String
Sheets("Report").Select
StsCol = Application.Range("A1000").End(xlUp).Row
a = 1
For i = 1 To StsCol
Sheets("Report").Select
If Range("C" & i).Value = "Open" Then
Range("C" & i).EntireRow.Copy
Sheets("T1 Open").Select
ActiveSheet.Range("A" & a).Select
Selection.PasteSpecial (xlValues)
a = a + 1
End If
Next
MsgBox "Done!"
End Sub
This does work on sorting the Open into a separate sheet, however, it is very slow and you the screen just blinks rapidly as it finds a row with Open and copies, then pastes it to the correct sheet.
I am not great a VB so any help is greatly appreciated. Hopefully I will learn something in the process
Many Thanks
John
I am sorry if this has been explained already but I cant find anything that quite does what I want.
Basically I have a table as follows with about 1000 lines of data.
[TABLE="width: 100, align: center"]
<tbody>[TR]
[TD]Reference[/TD]
[TD]Priority[/TD]
[TD]status[/TD]
[TD]description[/TD]
[TD]due date[/TD]
[TD]date submitted[/TD]
[/TR]
[TR]
[TD]123[/TD]
[TD]2[/TD]
[TD]Open[/TD]
[TD]abc[/TD]
[TD]01/03/13[/TD]
[TD]11/02/13 [/TD]
[/TR]
[TR]
[TD]134[/TD]
[TD]2[/TD]
[TD]Open[/TD]
[TD]jhg[/TD]
[TD]02/03/13[/TD]
[TD]11/02/13[/TD]
[/TR]
[TR]
[TD]124[/TD]
[TD]1[/TD]
[TD]AWC [/TD]
[TD]kli[/TD]
[TD]01/03/13[/TD]
[TD]11/02/13[/TD]
[/TR]
[TR]
[TD]321[/TD]
[TD]3[/TD]
[TD]AWC[/TD]
[TD]ijk[/TD]
[TD]01/03/13[/TD]
[TD]11/02/13[/TD]
[/TR]
[TR]
[TD]526[/TD]
[TD]4[/TD]
[TD]Escalated[/TD]
[TD]yhu[/TD]
[TD]02/03/13[/TD]
[TD]11/02/13[/TD]
[/TR]
[TR]
[TD]981[/TD]
[TD]4[/TD]
[TD]Escalated[/TD]
[TD]jhy[/TD]
[TD]01/03/13[/TD]
[TD]11/02/13[/TD]
[/TR]
[TR]
[TD]852[/TD]
[TD]2[/TD]
[TD]Open[/TD]
[TD]abd[/TD]
[TD]01/03/13[/TD]
[TD]11/02/13[/TD]
[/TR]
</tbody>[/TABLE]
Basically I want to sort these into separate sheets under the headings of the status column. I have tried writing macros however this is very messy and I am sure there is a better way of coding it.
I have also tried some code such as the following:
Sub go()
Dim StsCol As String
Sheets("Report").Select
StsCol = Application.Range("A1000").End(xlUp).Row
a = 1
For i = 1 To StsCol
Sheets("Report").Select
If Range("C" & i).Value = "Open" Then
Range("C" & i).EntireRow.Copy
Sheets("T1 Open").Select
ActiveSheet.Range("A" & a).Select
Selection.PasteSpecial (xlValues)
a = a + 1
End If
Next
MsgBox "Done!"
End Sub
This does work on sorting the Open into a separate sheet, however, it is very slow and you the screen just blinks rapidly as it finds a row with Open and copies, then pastes it to the correct sheet.
I am not great a VB so any help is greatly appreciated. Hopefully I will learn something in the process
Many Thanks
John