Hi Stan,
Welcome to ExcelFox !!
I don't think it's possible. I might be wrong though.
You could try this, which uses less loop
Code:Sub ChangeRows() Dim AH, a As Long, aa As Long Dim r As Range, ka() As String, k As String, n As Long With Range("a1") AH = .CurrentRegion.Resize(, 8) Set r = .Cells(1, 2).Resize(.CurrentRegion.Rows.Count, 7) End With For a = LBound(AH) To UBound(AH) If AH(a, 1) = "DEF" Or AH(a, 1) = "GHI" Then n = n + 1 ReDim Preserve ka(1 To n) ka(n) = a End If Next a Cells.Cells(1).CurrentRegion.Resize(, 8) = AH If n Then With r For a = 1 To n .Rows(ka(a)).Value = 0 Next End With End If End Sub




Reply With Quote

Bookmarks