I am trying to copy the rows that are highlighted in one sheet into another sheet, the rows that I want to copy are filled yellow.
I have some code already, that will copy only the highlighted rows, however it copies the rows that are not highlighted (but copies them without any values in). I want to only copy the rows with data and ignore the blank rows.
this is the code that I have:
I have some code already, that will copy only the highlighted rows, however it copies the rows that are not highlighted (but copies them without any values in). I want to only copy the rows with data and ignore the blank rows.
this is the code that I have:
VBA Code:
Sub CopyToBuildOutput()
Dim ws As Worksheet, MainWs As Worksheet, cell As Range
Set MainWs = Sheets("Build Output")
For Each ws In Sheets(Array("sheet1"))
If ws.Name <> MainWs.Name Then
For Each cell In ws.UsedRange
If cell.Interior.Color = vbYellow Then cell.Copy MainWs.Range(cell.Address)
'If cell.DisplayFormat.Interior.Color = vbYellow Then MainWs.Range(cell.Address) = cell.Value
Next
End If
Next
End Sub