Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default vba entering a formula in a certain cell

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




  #2   Report Post  
Posted to microsoft.public.excel.programming
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






  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default vba entering a formula in a certain cell

Hi Gary,

Worked great thanks


"Gary Keramidas" wrote:

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







Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Entering Formula - Cannot select cell as it is hidden by formula Jim Excel Worksheet Functions 0 March 25th 10 07:22 AM
Entering a Excel formula in a Cell through VBA? NooK[_20_] Excel Programming 2 June 30th 04 08:50 AM
Entering Sum formula into a cell Leo Heuser[_2_] Excel Programming 0 September 29th 03 07:55 PM
Entering Sum formula into a cell Bernard Liengme[_3_] Excel Programming 0 September 29th 03 04:11 PM
Entering Sum formula into a cell Don Guillett[_4_] Excel Programming 0 September 29th 03 03:55 PM


All times are GMT +1. The time now is 05:54 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"