G
Guest
Hi All,
I have the following code at the end of a long macro:
Columns("D").Find(What:="total").Select
ActiveCell.Offset(0, 4).Range("A1").Select
ActiveCell.FormulaR1C1 = "=Sum(RC[-1]-RC[-2])"
ActiveCell.NumberFormat = "0.00"
ActiveCell.Font.Bold = True
With ActiveCell.Interior
.ColorIndex = 6
End With
What I am doing is when the word "total" appears, it will go to the cell 4
columns to the right, and then do a formula and format the cell.
Question: How can I get this to repeat itself for each time the word
"total" appears. Each different time I run this macro, I may have anywhere
from 1 to 100 totals in the respective worksheet. I think that I need to
either loop, or do a for..next statement, but I don't know how to get the
syntax right, or which would work better.
Any help would be greatly appreciated...thanks in advance...
Sara
I have the following code at the end of a long macro:
Columns("D").Find(What:="total").Select
ActiveCell.Offset(0, 4).Range("A1").Select
ActiveCell.FormulaR1C1 = "=Sum(RC[-1]-RC[-2])"
ActiveCell.NumberFormat = "0.00"
ActiveCell.Font.Bold = True
With ActiveCell.Interior
.ColorIndex = 6
End With
What I am doing is when the word "total" appears, it will go to the cell 4
columns to the right, and then do a formula and format the cell.
Question: How can I get this to repeat itself for each time the word
"total" appears. Each different time I run this macro, I may have anywhere
from 1 to 100 totals in the respective worksheet. I think that I need to
either loop, or do a for..next statement, but I don't know how to get the
syntax right, or which would work better.
Any help would be greatly appreciated...thanks in advance...
Sara