Link to home
Start Free TrialLog in
Avatar of bsharath
bsharathFlag for India

asked on

Excel sheet find all rows which are colored and copy all contents in the row

Hi,

In the Excel sheet i want to find all rows which are colored and copy all contents in the row to a new sheet.

Regards
Sharath
Avatar of Hitesh Manglani
Hitesh Manglani
Flag of India image

Sub ACOPY()
s2row=1
 For i=1 to Sheet1.UsedRange.Rows.Count
         if Sheet1.Cells(i,1).Interior.Color <> RGB(255,255,255)
            Sheet1.Rows(i).Copy Destination:= Sheet2.Rows(s2row)
             s2row = s2row+1
         End if
End Sub
sorry
missed a next
Sub ACOPY()
s2row=1
 For i=1 to Sheet1.UsedRange.Rows.Count
         if Sheet1.Cells(i,1).Interior.Color <> RGB(255,255,255)
            Sheet1.Rows(i).Copy Destination:= Sheet2.Rows(s2row)
             s2row = s2row+1
         End if
Next
End Sub

Avatar of bsharath

ASKER

I get an error.

Cant execute code in break mode.
ASKER CERTIFIED SOLUTION
Avatar of Hitesh Manglani
Hitesh Manglani
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial