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

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
just remove Value From

Code:
Range("X13").Formula= "=IF((ISERROR((((M13/(E4*E5))-O13)/J13))),""NA"",((((M13/(E4*E5))-O13)/J13)))"
 
Upvote 0
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
 
Upvote 0
Hi
Try
=IF((ISERROR((((M13/(macro!E4)*(macro!E5))-O13)/J13))),"NA",((((M13/5*3)-O13)/J13)))
Ravi
 
Upvote 0

Forum statistics

Threads
1,213,496
Messages
6,113,993
Members
448,539
Latest member
alex78

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