I have spreadsheets that are created on the fly that can have 1 to hundreds of rows. There is always only just one column. I need to create 3 columns in the active spreadsheet from these results using VBA. So I need to count the number of rows, divide this number by 3, and put the second third in column B, and the final third in column 3. If the total rows is not exactly divisible by 3, then the higher counts go in the leftmost column.
Thus if there are 99 rows, Column A would contain rows 1-33, Column B 34-66, Column C 67-99.
If there were 100 rows, Column A would contain rows 1-34, Column B 35-67, and Column C 68-100.
If there were 101, Column A would contain rows 1-34, Column B 35-68, Column C 69-101.
Additional, if there was 1 row it would go in Column A, 2 rows, 1 record in Column A and 1 in Column B.
I have no idea as to how to accomplish this. Suggestions anyone?
I know I can count rows with this formula but that is about it.
Thanks VBA gurus.
Excel 2007
Thus if there are 99 rows, Column A would contain rows 1-33, Column B 34-66, Column C 67-99.
If there were 100 rows, Column A would contain rows 1-34, Column B 35-67, and Column C 68-100.
If there were 101, Column A would contain rows 1-34, Column B 35-68, Column C 69-101.
Additional, if there was 1 row it would go in Column A, 2 rows, 1 record in Column A and 1 in Column B.
I have no idea as to how to accomplish this. Suggestions anyone?
I know I can count rows with this formula but that is about it.
Code:
LastRow = ActiveSheet.UsedRange.Rows.Count
Thanks VBA gurus.
Excel 2007