Excel Macro Question

ggelineau

Board Regular
Joined
May 24, 2005
Messages
69
I recorded a macro in Excel and need to now modify it but have not idea where to start. The Macro was recorded in a spreadsheet titled "Macro" and the macro actually refers to actions taking place in order to modify a spreadsheet titled "Data". I was purposely vague to allow users to save over the "Data" spreadsheet and reuse the macro to format.

Once of the actions taken in the Macro is to insert the following formula into Cell X13 of the "Data" spreadsheet:
=IF((ISERROR((((M13/5*3)-O13)/J13))),"NA",((((M13/5*3)-O13)/J13)))

While this formula works perfectly well, I now need to change it so that the user to enter two numbers on the "Macro" spreadsheet and those two numbers will be used in the formula.

For instance, on the "Macro" spreadsheet, a user enter the number 6 into cell E4 and also enter the number 4 into cell E5. I need to add the values from these cells into the formula above as follows:

=IF((ISERROR((((M13/(Value From E4)*(Value From E5))-O13)/J13))),"NA",((((M13/5*3)-O13)/J13)))

Any help is much appreciate!!!!

Thanks,
G
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

iggydarsa

Well-known Member
Joined
Jun 28, 2005
Messages
1,647
just remove Value From

Code:
Range("X13").Formula= "=IF((ISERROR((((M13/(E4*E5))-O13)/J13))),""NA"",((((M13/(E4*E5))-O13)/J13)))"
 

ggelineau

Board Regular
Joined
May 24, 2005
Messages
69
Thanks for the quick reply iggydarsa.

The issue that I am having with simply adding the cell reference is that all of the actions taken in the macro is in reference to the active sheet on the "Data" spreadsheet and the cells that contain the information I would like to use are in the "Macro" spreadsheet.

Does that make sense?

Thanks,
G
 

ravishankar

Well-known Member
Joined
Feb 23, 2006
Messages
3,566
Hi
Try
=IF((ISERROR((((M13/(macro!E4)*(macro!E5))-O13)/J13))),"NA",((((M13/5*3)-O13)/J13)))
Ravi
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,279
Messages
5,836,363
Members
430,424
Latest member
ALHK022

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