geoffcraver
New Member
- Joined
- Aug 14, 2008
- Messages
- 8
Hello,
I'm looking to perform a calculation on some data from subtotals. Because of the format the last value isn't in column A and there are spaces in the data. Below is my code:
Cells(1, 23).Value = "Unused Lines"
'calculates the unused lines
x = 2
Do While Cells(1, x).Value <> ""
Cells(x, 23).Value = "=IF(ISNUMBER(SEARCH(""Total"",RC[-21])),(1-RC[-1]/RC[-2]),IF(ISNUMBER(SEARCH(""total"",RC[-20])),(1-RC[-1]/RC[-2]),IF(ISNUMBER(SEARCH(""Total"",RC[-18])),(1-RC[-1]/RC[-2]),IF(ISNUMBER(SEARCH(""total"",RC[-17])),(1-RC[-1]/RC[-2]),""""))))"
x = x + 1
Loop
How should I change the do while loop to a loop that runs until row 30,000?
Thanks
Mike
I'm looking to perform a calculation on some data from subtotals. Because of the format the last value isn't in column A and there are spaces in the data. Below is my code:
Cells(1, 23).Value = "Unused Lines"
'calculates the unused lines
x = 2
Do While Cells(1, x).Value <> ""
Cells(x, 23).Value = "=IF(ISNUMBER(SEARCH(""Total"",RC[-21])),(1-RC[-1]/RC[-2]),IF(ISNUMBER(SEARCH(""total"",RC[-20])),(1-RC[-1]/RC[-2]),IF(ISNUMBER(SEARCH(""Total"",RC[-18])),(1-RC[-1]/RC[-2]),IF(ISNUMBER(SEARCH(""total"",RC[-17])),(1-RC[-1]/RC[-2]),""""))))"
x = x + 1
Loop
How should I change the do while loop to a loop that runs until row 30,000?
Thanks
Mike