[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 245
  • Last Modified:

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
0
bsharath
Asked:
bsharath
  • 3
1 Solution
 
hiteshgoldeneyeCommented:
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
0
 
hiteshgoldeneyeCommented:
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

0
 
bsharathAuthor Commented:
I get an error.

Cant execute code in break mode.
0
 
hiteshgoldeneyeCommented:
Ok use this macro
Sub ACOPY()
s2row = 1
 For i = 1 To Sheet1.UsedRange.Rows.Count
         If Sheet1.Cells(i, 1).Interior.Color <> RGB(255, 255, 255) Then
            Sheet1.Rows(i).Copy Destination:=Sheet2.Rows(s2row)
             s2row = s2row + 1
         End If
Next
End Sub

0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now