View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary Keramidas Gary Keramidas is offline
external usenet poster
 
Posts: 2,494
Default vba entering a formula in a certain cell

see if this is what you need:

Sub insert_formulas()
Dim ws As Worksheet
Dim lastorw As Long
Set ws = Worksheets("Sheet1")
Dim lastrow As Long
lastrow = ws.Cells(Rows.Count, "E").End(xlUp).Row

With ws.Range("G6:G" & lastrow)
.Formula = "=F6-E6"
End With
End Sub

--


Gary


"umpire_43" wrote in message
...
Hi there,

I need some help with vba programming by creating a formula in cell g6

The Formula i like to enter in this cell = f6 - e6, but then each month the
number of rows will change. I need to be able to copy this formula down
based on the number of rows under row 6.

Can you help me?
Thanks