Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default VBA code for Sum and diff

I want VBA Code for formula which is like this

The Formula is in loop
i value keep on changing in loop
Di=Ai+B(i-1)-C(i-2)

So in D10 then formula should be like this =A10+B9-C8

I don't want R1C1 Method


I am trying for last two weeks...

Regards
Dhir





  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,872
Default VBA code for Sum and diff

Hi,

Am Sun, 24 Mar 2013 21:31:42 -0700 (PDT) schrieb dhir:

I want VBA Code for formula which is like this

The Formula is in loop
i value keep on changing in loop
Di=Ai+B(i-1)-C(i-2)

So in D10 then formula should be like this =A10+B9-C8


you don't have to loop. You can autofill the formula.
Try:

Sub Test()
Dim LRow As Long
LRow = Cells(Rows.Count, 1).End(xlUp).Row

Range("D3").Formula = "=A3+B2-C1"
Range("D3").AutoFill Range("D3:D" & LRow)
End Sub


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
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
plotting column chart whch colors the bars diff for diff comm Cathy Charts and Charting in Excel 5 March 19th 09 06:30 PM
SUMIF formula required to search for 2 diff values in 2 diff colum Lidy693 Excel Worksheet Functions 7 February 21st 09 09:45 PM
how you make links between diff. cells on diff. work sheets NYC-MIKE Excel Worksheet Functions 3 February 11th 08 05:05 PM
code to input date after diff. cell selected Kelzina Excel Programming 2 November 22nd 06 05:45 AM
code for sum of sht with diff # of rows Paulg[_7_] Excel Programming 2 July 17th 06 03:55 PM


All times are GMT +1. The time now is 01:24 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"