Sub Vymaz_B_AA()
Dim R As Long, i As Long, B(), rngCAA As Range, rngAB As Range, rng As Range, HLADAJ
HLADAJ = 703320
With ThisWorkbook.Worksheets("List1")
R = .Cells(Rows.Count, 2).End(xlUp).Row
B = .Cells(1, 2).Resize(R).Value2
For i = 1 To R
If B(i, 1) = HLADAJ Then
If rngCAA Is Nothing Then
Set rngCAA = .Range("B1:AA1").Offset(i - 1, 0)
Set rngAB = .Cells(i, "AB")
Else
Set rngCAA = Union(rngCAA, .Range("B1:AA1").Offset(i - 1, 0))
Set rngAB = Union(rngAB, .Cells(i, "AB"))
End If
End If
Next i
End With
If Not rngAB Is Nothing Then
For Each rng In rngAB.Areas
rng.Value2 = rng.Value2
Next rng
rngCAA.ClearContents
End If
End Sub
EDIT:
V oblasti som urobil preklep. Namiesto C1:AA1 má byť samozrejme B1:AA1. V prílohe aj v kóde som to opravil.