Cut Paste Coloured Text

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi!
Me again. Now the task is that is there any way to Cut the complete row if
one of its field "Result" have the RED COLOURED data from "Student Status"
Worksheet, and Paste it to Fisrt Empty row of "Student Result".

There are Four fields, Roll Number, Name, Class, Result. I applied the
Conditional Formatting that if the filed "Result" has "Fail" then it will
apper in RED COLOUR. Now I want that when I Click on the "Update" buttong
located on "Update Database" Worksheet then all the Row having red coloured
items in them will be coppied to 2nd sheet. Note that I can't copy that rows
upon the text but their colour that is Red.

Any One Could Help.
 
You can try the following macro.
(The macro will first locate the column number for the column "Reult".
Therefore, it won't matter where that column is positioned or you move it at
a later time.)

Sub move_rows()
Dim tmp As Single
Dim tmp2 As Integer
Dim tmp_object As Object
Dim rows_counter As Single, counter As Single

Set tmp_object = Worksheets("Student Result")
rows_counter = tmp_object.Range("A1").CurrentRegion.Rows.Count

With Worksheets("Student Status").Range("A1").CurrentRegion
For tmp = 1 To .Columns.Count
If UCase(.Rows(1).Cells(tmp).Value) = "RESULT" Then
tmp2 = tmp
Exit For
End If
Next
For tmp = 1 To .Rows.Count
If .Rows(tmp).Cells(tmp2).Font.ColorIndex = 3 Then
.Rows(tmp).Copy tmp_object.Rows(rows_counter + counter)
counter = counter + 1
End If
Next
End With
End Sub


Regards,
Edwin Tam
http://www.vonixx.com/
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top