I have a column of values that I need to check whether they are greater than zero or not. If they are greater than zero then I need to take the value from 3 columns to the right and place it on the column 3 places to the left. I then want it to move to the next row and do the same.
This is the code i am using:
Private Sub CommandButton2_Click()
Dim order As Range
Dim i As Integer
Set order = Range("h8:h74"
For i = 1 To order.Rows.Count
If order.Cells(i, h).Value > 0 Then
Range(i, h).Select
ActiveCell.Offset(0, -3) = ActiveCell.Offset(0, 4)
ActiveCell.Offset(0, -4) = ActiveCell.Offset(0, 4)
End If
i = i + 1
Next i
Range("h8:h74"
.Select
Selection.ClearContents
End Sub
The problem I am having is that I can't get the next row down to be the active cell, so in the first row h8 is the active cell (but only if that was the last cell I clicked in), on the next loop I need it to be h9 so all the relative references work. How can I get the active cell to be the row the loop is on?
Hope this makes sense to someone,
Thanks
Steph
This is the code i am using:
Private Sub CommandButton2_Click()
Dim order As Range
Dim i As Integer
Set order = Range("h8:h74"
For i = 1 To order.Rows.Count
If order.Cells(i, h).Value > 0 Then
Range(i, h).Select
ActiveCell.Offset(0, -3) = ActiveCell.Offset(0, 4)
ActiveCell.Offset(0, -4) = ActiveCell.Offset(0, 4)
End If
i = i + 1
Next i
Range("h8:h74"
Selection.ClearContents
End Sub
The problem I am having is that I can't get the next row down to be the active cell, so in the first row h8 is the active cell (but only if that was the last cell I clicked in), on the next loop I need it to be h9 so all the relative references work. How can I get the active cell to be the row the loop is on?
Hope this makes sense to someone,
Thanks
Steph