# Getting Excel to Recaclulate IF Macro

#### mcphatt

##### New Member
Hi everyone,

I have a macro button which calculates the active sheet, which is fine, but sometimes the division which the sheet is doing throws up a solution which is not an integer. So, I was wondering if I can put an if statement into the macro code to tell excel to keep calculate until it returns an interger.

Essentially I want:

IF F12<>INT THEN ActiveSheet.Calculate

but I don't know how to put this in code form.

Thanks

### Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a \$25,000 loan, 5% annual interest, 60 month loan.
Maybe like this

Code:
``````Do Until Range("F12").Value = Int(Range("F12").Value)
Calculate
Loop``````

Thanks so much, that is perfect!!

Replies
5
Views
205
Replies
3
Views
524
Replies
3
Views
110
Replies
2
Views
117
Replies
10
Views
431

1,202,990
Messages
6,052,948
Members
444,620
Latest member
marialewis16

### 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.

### Which adblocker are you using?

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

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