LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 107
Default write a formula to a cell using VBA

I wnated to write a simple formula like "=SUM(C12:C18)" in to a cell using VBA.

I have following code

Sheets(wsDestination).Cells(I, eColumn).Formula = "=SUM(C12:C18)"

The problme is I have the code in a for loop and I need change the cells
depends on the for loop index like

when I = 1 then "=SUM(C12:F12)"
when I = 2 then "=SUM(C13:F13)"
when I = 3 then "=SUM(C14:F14)"

The C and F depend on a variable to control.

Any information is great appreciated,

 
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
how do I write a formula to copy text from one cell to another? TR Excel Worksheet Functions 2 February 9th 06 03:49 PM
how do I write a formula: if (cell address) is less than X add Y CTrophyMan Excel Discussion (Misc queries) 4 December 1st 05 06:17 PM
How do you write an excel formula to sum data in every second cell Sarah needs to know Excel Worksheet Functions 5 November 18th 05 05:28 PM
How can I write an if-then formula for 0 or less than 0 in cell t. Baz1 Excel Worksheet Functions 1 November 30th 04 04:33 PM
Question: Cell formula or macro to write result of one cell to another cell Frederik Romanov Excel Programming 1 July 8th 03 03:03 PM


All times are GMT +1. The time now is 10:23 PM.

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

About Us

"It's about Microsoft Excel"