I have a spreadsheet that I need to rearrange to improve readability.
I have an example attache, which is easier to understand than describing it, but I'll try:
I want to start in a1, move to a2
copy a2 to b1
delete line 2 (the previous lrow 3 now becomes row 2
if a2 > 0.01, skip it and
move & select cell a3
... and repeat the above logic, on the next series of cells...
eg
copy a3 to b2
delete line 3 (the previous lrow 4 now becomes row 3
if a3 > 0.01, skip it and
move & select cell a4
...and repeat the sequence again.
The code that I wrote partially works - When I add in the commented out lines, it does not do what I described above.
Could someone show me the error of my ways?
Sub Macro13()
'
'
Sheets("Sheet1").Select
Range("A2").Select
Do Until Selection.Offset(-1, 0).Value = ""
Selection.Cut
ActiveCell.Offset(-1, 1).Select
ActiveSheet.Paste
ActiveCell.Offset(1, -1).Rows("1:1").EntireRow.Select
Selection.Delete Shift:=xlUp
ActiveCell.Offset(1, 0).Range("A1").Select
'If (ActiveCell.Offset(1, 0).Range("A1").Select > 0.1) Then
' ActiveCell.Offset(0, 0).Range("A1").Select
'End If
Loop
Range("A1").Select
End Sub
The code with the lines commented out, works to select, and move the cells in each row..when I uncomment the code that checks and skips a row, it does not behave the way I intended.
Any help is appreciated.
Best regards,
J
Bookmarks