Thread: VB Code
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default VB Code

Sub missive()
Dim n As Long
n = Cells(Rows.Count, "B").End(xlUp).Row
ActiveCell.Formula = "=C2/B" & n
End Sub


This is the easy part - creating a formula for C2
--
Gary''s Student - gsnu200717


"Stan" wrote:

I'm trying to divide Cell C2 by the data in the last row in Column B. Can
anyone help me with the VB coding for this?

ActiveCell.FormulaR1C1 = "=RC[-1]/ "

Also, after I've done the division I'm trying to write code to auto-fill
from cell C2 down to the row that contains the word "Total" in column A. In
other words, if the word "Total" appears in Cell A41 then I would like to
have code that auto-fills cells C2:C41. The problem I'm having is the word
"Total" will appear only once but in different rows within column A each day.
Any thoughts?