View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Pete McCOsh Pete McCOsh is offline
external usenet poster
 
Posts: 64
Default Problem with using formula

Sameer,

cells(3,1).formula = "=A4+A5"
Will create the first formula, if required.

cells(3,1).copy destination:= range("B3:D3")
Will copy the formula relatively, just change the
destination range as necessary.

Cheers, Pete

-----Original Message-----
Hi,
I want to incorporate formulas to different cell on

command button
click. The formula is common for different columns just

the position of
the cells value to be used shifts by one column.

To explain, say I have a formula for cell A3 which is

A3=A4+A5.
Similary, I want to use this formula for the next cells

like B3=B4+B5
and so on for C,D.

Instead of writing the same formula every time, I want to

make this
dynamic by changing the value of A to B, C and so on.

I tried using Range((Chr(Asc("A") + i)) & iCounter).value

by putting
this stmt in a for loop for i. But, this thing when put

in the formula
does not works.

Can anyone suggest a solution to this problem.

Thanks,
Sameer


---
Message posted from http://www.ExcelForum.com/

.