View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default Macro Flexability

What do you have in R218C4? If you are adding or deleting rows this is going
to move and we need some way to find it dynamically. Is it the last cell in
column 4 or does it have a title or ...
--
HTH...

Jim Thomlinson


"wblake0926" wrote:

Hello,
I am looking to make this macro a little more flexible, if I am to add or
remove data I want this to preform the same function. can anyone help me
adjust this so this is possible Thanks for the assistance
Sub Percentages()
'
' Percentages Macro
' Macro recorded 9/30/2009 by e447207
'

Cells.find(What:="Total", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False _
, SearchFormat:=False).Activate
Range("E7").Select
ActiveCell.FormulaR1C1 = "=RC[-1]/R218C4"
Cells.FindNext(After:=ActiveCell).Activate
Range("E15").Select
ActiveCell.FormulaR1C1 = "=RC[-1]/R218C4"
Cells.FindNext(After:=ActiveCell).Activate
Range("E30").Select
ActiveCell.FormulaR1C1 = "=RC[-1]/R218C4"
Cells.FindNext(After:=ActiveCell).Activate
Range("E33").Select
ActiveCell.FormulaR1C1 = "=RC[-1]/R218C4"
Cells.FindNext(After:=ActiveCell).Activate
Range("E45").Select
ActiveCell.FormulaR1C1 = "=RC[-1]/R218C4"
Cells.FindNext(After:=ActiveCell).Activate
Range("E69").Select
ActiveCell.FormulaR1C1 = "=RC[-1]/R218C4"
Cells.FindNext(After:=ActiveCell).Activate
Range("E80").Select
ActiveCell.FormulaR1C1 = "=RC[-1]/R218C4"
Cells.FindNext(After:=ActiveCell).Activate
Range("E97").Select
ActiveCell.FormulaR1C1 = "=RC[-1]/R218C4"
Cells.FindNext(After:=ActiveCell).Activate
Range("E103").Select
ActiveCell.FormulaR1C1 = "=RC[-1]/R218C4"
Cells.FindNext(After:=ActiveCell).Activate
Range("E111").Select
ActiveCell.FormulaR1C1 = "=RC[-1]/R218C4"
ActiveWindow.SmallScroll Down:=6
Cells.FindNext(After:=ActiveCell).Activate
Range("E113").Select
ActiveCell.FormulaR1C1 = "=RC[-1]/R218C4"
Cells.FindNext(After:=ActiveCell).Activate
Range("E132").Select
ActiveCell.FormulaR1C1 = "=RC[-1]/R218C4"
Cells.FindNext(After:=ActiveCell).Activate
Range("E164").Select
ActiveCell.FormulaR1C1 = "=RC[-1]/R218C4"
Cells.FindNext(After:=ActiveCell).Activate
Range("E179").Select
ActiveCell.FormulaR1C1 = "=RC[-1]/R218C4"
Cells.FindNext(After:=ActiveCell).Activate
Range("E181").Select
ActiveCell.FormulaR1C1 = "=RC[-1]/R218C4"
Cells.FindNext(After:=ActiveCell).Activate
Range("E193").Select
ActiveCell.FormulaR1C1 = "=RC[-1]/R218C4"
Cells.FindNext(After:=ActiveCell).Activate
Range("E212").Select
ActiveCell.FormulaR1C1 = "=RC[-1]/R218C4"
Cells.FindNext(After:=ActiveCell).Activate
Range("E216").Select
ActiveCell.FormulaR1C1 = "=RC[-1]/R218C4"
Cells.FindNext(After:=ActiveCell).Activate
Range("E218").Select
Selection.FormulaR1C1 = "="
Range("E218").Select
ActiveCell.FormulaR1C1 = "=SUM(R[-212]C:R[-1]C)"
End Sub