S
Stuart
I have data as follows:
Row colB colC
50 data..... 5
51 data.....
52 data.......
and
50 data......
51 data........
52 data........ 5
each of the above represents a dataset
there is always at least one blank row between datasets
The first dataset is fine. In the second, I would like to
move '5' in C52 up to C50.
I would like to loop through col C and test if the value
in col C is at the start of the dataset.....if not, then
move it to the start
For Each c In .UsedRange.Columns("C")
If Not IsEmpty(c) Then
QtyRw = c.Row
StartRw = c.Offset(0, -1).End(xlUp).End(xlDown).Row
If StartRw < QtyRw Then
.Range("c" & StartRow) = c.Value
.Range("c" & QtyRw).ClearContents
End If
End If
Next
Is there a better approach please?
Regards.
Row colB colC
50 data..... 5
51 data.....
52 data.......
and
50 data......
51 data........
52 data........ 5
each of the above represents a dataset
there is always at least one blank row between datasets
The first dataset is fine. In the second, I would like to
move '5' in C52 up to C50.
I would like to loop through col C and test if the value
in col C is at the start of the dataset.....if not, then
move it to the start
For Each c In .UsedRange.Columns("C")
If Not IsEmpty(c) Then
QtyRw = c.Row
StartRw = c.Offset(0, -1).End(xlUp).End(xlDown).Row
If StartRw < QtyRw Then
.Range("c" & StartRow) = c.Value
.Range("c" & QtyRw).ClearContents
End If
End If
Next
Is there a better approach please?
Regards.