VBA to capture Formulae using data in separate w/books

Tj_El

Board Regular
Joined
Mar 28, 2003
Messages
69
Hi VBA Gurus.

I hope I have described the issue properly in the thread subject.

I have a macro that basically generates and saves a csv file from data in a workbook. I started by inserting a new worksheet into the workbook containing the raw data but what is actually required was that a new workbook be used instead of adding a worksheet.

Recorded macro for this but now the formulae below don't work.

Range("A2").Select
ActiveCell.FormulaR1C1 = "=IF(OR(Sheet1!RC[5]=83,Sheet1!RC[5]=40),40,50)"
Range("B2").Select
ActiveCell.FormulaR1C1 = "=IF(Sheet1!RC[3]=3621015,3621010,3401040)"
Range("C2").Select
ActiveCell.FormulaR1C1 = "=Sheet1!RC[9]"
Range("G2").Select
ActiveCell.FormulaR1C1 = "=Sheet1!RC[2]&""EX"""
Range("L2").Select
ActiveCell.FormulaR1C1 = "=Sheet1!RC[-9]&"" - ""&Sheet1!RC[-11]"
Range("M2").Select
ActiveCell.FormulaR1C1 = "=Sheet1!RC[-3]&""-""&Sheet1!RC[-6]"
Range("N2").Select
ActiveCell.FormulaR1C1 = "=Sheet1!RC[-13]"
Range("N2").Select
Range(Selection, Cells(ActiveCell.Row, 1)).Select
Selection.AutoFill Destination:=Range("A2:N8440"), Type:=xlFillDefault
Columns("N:N").Select

I think the "Sheet1!RC" reference is the culprit but I don't know what to use to replace it so I need some expert help in fixing this.

Any helpers out there? Thanks in advance.
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

Forum statistics

Threads
1,214,983
Messages
6,122,588
Members
449,089
Latest member
Motoracer88

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
Back
Top