ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how to fill formula in any cell and drag it? (https://www.excelbanter.com/excel-programming/369887-how-fill-formula-any-cell-drag.html)

vumian[_58_]

how to fill formula in any cell and drag it?
 

hi everyone,

Please help me as following:
- i wanna use VBA to fill automatically a formula in any cell i don'
know before
- then, drag that cell to right 2 cells more
- after that, select 3 cells, drag all of them down to last row - 4
because amount of rows update frequently. last row of formula is las
row -4.

thanks in advance

--
vumia
-----------------------------------------------------------------------
vumian's Profile: http://www.excelforum.com/member.php...fo&userid=3649
View this thread: http://www.excelforum.com/showthread.php?threadid=57000


NickHK

how to fill formula in any cell and drag it?
 
Did you try recoding a macro ?
I got this:

Range("C7").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=SUM(R[-4]C:R[-1]C)"
Range("C7").Select
Selection.AutoFill Destination:=Range("C7:E7"), Type:=xlFillDefault
Range("C7:E7").Select
Selection.AutoFill Destination:=Range("C7:E10"), Type:=xlFillDefault
Range("C7:E10").Select

NickHK

"vumian" wrote in
message ...

hi everyone,

Please help me as following:
- i wanna use VBA to fill automatically a formula in any cell i don't
know before
- then, drag that cell to right 2 cells more
- after that, select 3 cells, drag all of them down to last row - 4,
because amount of rows update frequently. last row of formula is last
row -4.

thanks in advance.


--
vumian
------------------------------------------------------------------------
vumian's Profile:

http://www.excelforum.com/member.php...o&userid=36494
View this thread: http://www.excelforum.com/showthread...hreadid=570009




vumian[_60_]

how to fill formula in any cell and drag it?
 

hi man,

thanks for your help, but

i mean, i drag down to last rows-4. it does not mean to drag down
row

thanks for help one more

--
vumia
-----------------------------------------------------------------------
vumian's Profile: http://www.excelforum.com/member.php...fo&userid=3649
View this thread: http://www.excelforum.com/showthread.php?threadid=57000



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com