This question may seem odd and is perhaps downright whimsical. I have searched for macros that could serve my purpose but have not found anything that would search in reverse numerical sequence from the bottom of a spreadsheet. I am using LibraOffice version 4 on Centos 6.5. My spreadsheet has 25 columns and many rows. The cells of each row/column are populated with a number from 1 to 50 and arranged in no particular order. A new row of numbers are frequently added at the bottom of the sheet. I need to write a macro that will:
- Find the last row containing data.
- For each column and value in a cell in the last row, search the previous rows for the next lower value until the entire sequence of numbers (1 through 50 and a max one number decremented per row) have been found. For example, if a cells value on the first column in the last row = 5 then search backwards row by row for the numbers 4,3,2,1,50,49.48…10,9,8,7 and finally 6. Perform this on each column of each row.
- Keep track of the number of rows passed during the search and divide Nrows by 50 for the average rows a number decrements.
- Rerun macro for each new row that is added.
I would really like to read some suggestions or example code on how this can be done Seems that it should be a for loop in reverse?