ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Fill in Formulas (https://www.excelbanter.com/excel-programming/335438-fill-formulas.html)

snax500[_2_]

Fill in Formulas
 
In Excel2000, I have the following formulas:

A B c
1
2 +B2
3 +C2
4
5
6
7

I want to create a macro to select a range (say A4:A20) that will look
at the previous row's formula and add one column to column reference.
My output will then look like:

A B c
1
2 +B2
3 +C2
4 +D2
5 +E2
6 +F2
7 +G2
etc, etc.

Any ideas?

Thanks


Tom Ogilvy

Fill in Formulas
 
for each cell in selection
cell.formula = "+" & cells(2,cell.row).Address(0,0)
Next

--
Regards,
Tom Ogilvy

"snax500" wrote in message
oups.com...
In Excel2000, I have the following formulas:

A B c
1
2 +B2
3 +C2
4
5
6
7

I want to create a macro to select a range (say A4:A20) that will look
at the previous row's formula and add one column to column reference.
My output will then look like:

A B c
1
2 +B2
3 +C2
4 +D2
5 +E2
6 +F2
7 +G2
etc, etc.

Any ideas?

Thanks




Bob Phillips[_6_]

Fill in Formulas
 
Why use a macro

in A2, use

=INDEX($2:$2,1,ROW())

and copy down

--

HTH

RP
(remove nothere from the email address if mailing direct)


"snax500" wrote in message
oups.com...
In Excel2000, I have the following formulas:

A B c
1
2 +B2
3 +C2
4
5
6
7

I want to create a macro to select a range (say A4:A20) that will look
at the previous row's formula and add one column to column reference.
My output will then look like:

A B c
1
2 +B2
3 +C2
4 +D2
5 +E2
6 +F2
7 +G2
etc, etc.

Any ideas?

Thanks





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

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