# How do I put a formula in a VB

#### bjurney

##### Active Member
Currerntly I have a formula (along with others) in a cell that returns a certain number, we will say 7 for this example

=ROUNDUP(COUNTIF(\$O:\$O,B10)*B11,0)

I want to know how I can put this in VB so I dont have to have the formula in the cell but the cell will still return 7. I have diffrent formulas, and I seem to remeber seeing something about it before, but wasnt sure where or what to search for.

### Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

#### shg

##### MrExcel MVP
Maybe
Code:
``range("a1").value = evaluate("=ROUNDUP(COUNTIF(\$O:\$O, B10) * B11, 0)")``

#### bjurney

##### Active Member
Exactly what I needed, thanks!

You're welcome!

Replies
5
Views
149
Replies
6
Views
68
Replies
4
Views
126
Replies
3
Views
271
Replies
0
Views
231

1,191,719
Messages
5,988,290
Members
440,148
Latest member
sandy123

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