User Defined Function Working in Immediate window but nowhere else

D_Miller

New Member
Joined
Dec 17, 2019
Messages
15
Office Version
  1. 2016
Good Morning guys,

I have a User defined Function (UDF) which takes various ranges of cells in a column and compares them. Each range consists of one column only and the objective of the function is to look across these columns and identify the cell with the lowest value and change its color to yellow. The business context is that i can have between 2-5 suppliers with their prices and the aim is to identify the supplier with the lowest price on each item they have quoted on.

The function works fine but the problem is it only works when I call it from the immediate window. '?udf_IdentifyLowestCost("A2:A5", "B2:B5", "C2:C5", "D2:D5")

Outside the VBA editor and on the Excel Data entry area if I call the same UDF by using =udf_IdentifyLowestCost(A2:A5, B2:B5, C2:C5, D2:D5) nothing happens.

Can someone shed some light on this?
 
You're welcome & thanks for the feedback
 
Upvote 0

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.
Ok guys I got a wonderful solution to my problem without adjusting my code.

I created a user form from the VBE environment and passed the data in the controls from this from into my UDF function then run it from the workbook.

Eureka, it causes my UDF function to format the workbook and change the formatting on the cells as per the code in the function.

Feeling so happy now...! :cool::)
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,179
Members
453,021
Latest member
Justyna P

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