This is how the code works-
l1 is the last row on Sheet1
The macro runs for every value from k= 1 to k= l1 i.e. the last row number
Instead of going from all rows from 1 down to 956 we decide to go from 965 up to the first row.
This is because rows have to be deleted and this would create problems with the row numbers. Like if k=3 i.e. 3rd row is deleted then the 4th row becomes the 3rd row. But macro would go for k=4 next time i.e. row 4. This means we have missed a row in between that changed form row 4 to row 3 on deleting row 3.
So n is the row number calculated by subtracting k from l1 and adding 1
example-
for k=1, n=965-1+1=956
for k=2, n=956-2+1=955
and so on...
Checks if there are less than 3 values in columns H to CS
l2 is the last used row on sheet2 plus one i.e. the first unused row.
Puts the value from columns A to CS in Sheet2 if there are less than 3 values.
Deletes the row from Sheet1
If there are more than 2 values then the macro does nothing.
Goes for the next k and finally ends.
Bookmarks