VBA syntax for allowing the input of a cell to be equal to a variable value

annie_54

New Member
Joined
Jul 22, 2019
Messages
3
Sorry for the confusing title, essentially what I am trying to accomplish is creating the VBA for the excel ceiling_math function so I can use it in a linear interpolation function I am creating. I would like to figure out the code to allow the unitcount and significance in this code (bolded) to be entered and/or selected by the user. I have the unitcount equal to the active cell value but I know that will not work how I want it to.

Thank you!

---------------------------------------------------------------------------------------------------------
Function CeilingTry1()


Dim unitcount As Double


Dim significance As Double


Dim ceilingmathUnitcount As Double

unitcount = ActiveCell.Value


ceilingmathUnitcount = Application.WorksheetFunction.Ceiling_Math(unitcount, significance)

MsgBox "The value is " & ceilingmathUnitcount




End Function


-----------------------------------------------------------------------------------------------------------
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
You can do this:

Code:
Function CeilingTry1(unitcount As Range, significance As Range)

Is that what you mean?
 
Upvote 0

Forum statistics

Threads
1,213,543
Messages
6,114,237
Members
448,555
Latest member
RobertJones1986

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