In an Excel doc, I'm trying to copy entire row values, AND preserve formatting AND formulas based on a couple of conditions in one particular column. I am new to this and can likely eventually figure out what I am doing, but have limited time to dedicate to it.
Below is what I've tried and is working to copy the values in column L that meet the conditions (bold text OR yellow highlights), but it does not preserve the formatting, nor does it copy the entire row of values and formulas.
Sub Button1_Click()
Dim myrange As Range
Dim startrow As Long
Dim workrange As Range
startrow = 2
Set workrange = Sheets("Full").Range("L2: L424")
For Each myrange In workrange
If myrange.Font.Bold Or myrange.Interior.ColorIndex = 6 Then
Sheets("Test").Cells(startrow, 12) = myrange.Value
startrow = startrow + 1
End If
Next
End Sub
Aucun commentaire:
Enregistrer un commentaire