ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Cut Paste Coloured Text (https://www.excelbanter.com/excel-programming/319331-cut-paste-coloured-text.html)

Saadi

Cut Paste Coloured Text
 
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.

Edwin Tam[_7_]

Cut Paste Coloured Text
 
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/




"Saadi" wrote:

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.



All times are GMT +1. The time now is 09:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com