View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default Operate on each cell in range.

select a group of cells and run the following...

Sub Adjust_Formula()
dim rng as range

for each rng in selection
rng.Formula = "=" & rng.Value * 2 & "*(QTR/4)"
next rng
End Sub

--
HTH...

Jim Thomlinson


"Fred Holmes" wrote:

How do I put wrapper code around the below, so that I can select a
range of "many" cells and have the code execute on each cell in turn?

For each cell in selected range (selection) . . .

Sub Adjust_Formula()
ActiveCell.Formula = "=" & ActiveCell.Value * 2 & "*(QTR/4)"
End Sub

The formula works fine on a single cell.

Many thanks,

Fred Holmes