0

I am trying to do a loop action (copy & paste onto another row) and will only break the loop when the whole range (each cell in a row) reaches 0.

Row A: H35:AK35 - (target copy row) Row B: H36:AK36 - Targeted Row to paste the values (target paste row/location) Row C: H37:AK37 - Delta between Row B and Row A

The loop action which copies Row A and pastes onto Row B should end when each cell in Row C reaches 0.

Here is my code, but it is not working.

Do Until Range("H37:AK37").Value = 0

Sheets("Timing").Activate
Sheets("Timing").Range("H35:Ak35").Select
Selection.Copy

Sheets("Timing").Range("H36:AK36" & i).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False

Loop


End Sub

I think the code is not checking if each cell in Row C: H37:AK37 is equals to zero.

braX
  • 11,506
  • 5
  • 20
  • 33
  • 2
    Please see [How to create a Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) and don't forget to read [Why is “Can someone help me?” not an actual question?](https://meta.stackoverflow.com/questions/284236/why-is-can-someone-help-me-not-an-actual-question) – Foxfire And Burns And Burns Feb 02 '18 at 09:47
  • How is each cell in the Row C going to become 0 while the code is running? – dev1998 Feb 02 '18 at 14:18
  • Do you distinguish between cells which are blank and cells which contain the value 0? – John Coleman Feb 02 '18 at 14:22

1 Answers1

0

Here is a way to check the cells in the range:

Sub CheckCells()

    Dim rCell As Range
    Dim rRng As Range

    Set rRng = Sheet1.Range("H37:AK37")

    For Each rCell In rRng.Cells

        If rCell.Value = 0 Then

            'Do something here

        End If

    Next rCell


End Sub

I used this to help Loop through each cell in a range of cells when given a Range object

dev1998
  • 882
  • 7
  • 17