Formula refuses to Calculate

5L2F

New Member
Joined
Oct 15, 2005
Messages
11
I have 2 adjacent cells. One is for entering a number. The adjacent cell prints XXX if the adjacent number is less than 10 and YYY if the number is more than 10. Here is the code:

Code:
=IF(M18>9,"XXX","YYY")

If I enter a number manually it works fine. (y) But I don't want to enter it manually. I have created a macro that pops up a dialog box and I enter the number into the box. It then pastes the information on to the worksheet at M18.

My problem is that when it pastes from the dialog box, the adjacent cell does not recognise it. It does not do 'its thing.' The formula refuses to calculate. Can someone tell me what to do please?

Chris
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
You could try adding adding

Calculate

as the last line of your macro code?



Also, is your spreadsheet set to automatic calculation? (Tools->Options->Calculation->Automatic)
 
Upvote 0
Inputbox returns a string variable (and so do TextBoxes), so it may also be worthwhile casting the return as a value using the Val function (and have automatic calculation selected for the sheet). You don't post your code, so this is a guess, but it will look something like this:

Code:
Range("M18").Value = Val(Inputbox("Enter your number"))

Regards

Richard
 
Upvote 0

Forum statistics

Threads
1,215,004
Messages
6,122,659
Members
449,091
Latest member
peppernaut

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