View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
enyaw enyaw is offline
external usenet poster
 
Posts: 108
Default inserting formula

How do i ignore the first row? I also need to be able to sum three cells in
the row. Any ideas on how to this? This is what i am using.

Sub CommandButton4_Click()
Dim rng As range, cell As range
Set rng = Columns(1).SpecialCells(xlConstants) ' or xlformulas
For Each cell In rng
cell.Offset(0, 8).Formula = "=sum(9,F2:H2)"
Next

End Sub

"Tom Ogilvy" wrote:

Dim rng as Range, cell as Range
set rng = Columns(1).Specialcells(xlConstants) ' or xlformulas
for each cell in rng
cell.offset(0,1).formula = "=if(" & cell.Address(0,0) & _
"<"""",""Filled"",""empty"")"
Next

--
regards,
Tom Ogilvy


"enyaw" wrote:

I want to insert a formula into a row if the first cell in the row has
something in it. I need to check through a range of cells but the range of
cells will be different every time. How would i program this?