Macro to insert cell values into formula

richard_brussels

New Member
Joined
Jul 25, 2008
Messages
5
Hi,
I'm having difficulty making a formula within VBA.
I want to enter the column and number of rows as variables, then read in the data, then make a formula using this data.

eg. B3:B6 2
3
4
5

B2 = choose(A2,2,3,4,5)

I want to do this on multiple columns on multiple sheets with many rows each time - therefore typing the formula is not an option!
Also I want to use these formulas in other books, therefore I want the "choose" formula rather than using a "lookup".

Thanks for reading
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.

Forum statistics

Threads
1,191,686
Messages
5,988,068
Members
440,125
Latest member
vincentchu2369

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top