I'm trying to set variable endofSheet
to the range from cell C7 to the last filled cell in columnn C, within a For loop that cycles through each worksheet in the workbook. endofSheet
will then be used as a range for a For loop that will match each row's interior color to that of its cell in the C column.
Sub prepReport()
Dim ws As Worksheet
Dim cell, endofSheet As Range
For Each ws In Worksheets
ws.Name = ws.Range("E2").Value
endofSheet = ws.Range("C7", ws.Range("C7").End(xlUp)) 'This is the problem line
For Each cell In endofSheet
cell.EntireRow.Interior.Color = cell.Interior.Color
Next
Next
End Sub
It's been years since I've done real work in VBA, but I'm really wracking my brain here trying to figure out what I'm doing wrong.
I've resorted to reducing my code to the bare minimum to try and weed out any unforeseen conflicts. Any help with this would be greatly appreciated.