Formulas don't work in a userform

Jim Stewart

New Member
Joined
Oct 18, 2006
Messages
14
Erdinç E. Karaçam gave me some formulas to total columns on a different sheet and when the information is entered manually, they work great. However, when I enter them thru a userform, they don't work.
formulas:
=Count(Sheet1!A:A)
=Sum(Sheet1!A:A)

Can anyone help?
Thanks in advance.
Jim
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Hello Jim,
How are you trying to enter these?
Something like this will work.
Code:
Private Sub CommandButton1_Click()
Sheets("Sheet2").[B1].Formula = "=Count(Sheet1!A:A)"
Sheets("Sheet2").[C1].Formula = "=Sum(Sheet1!A:A)"
End Sub

This anything close to what you're wanting to do?
 
Upvote 0
I'm enmtering them as a formula in a cell. I think I've found the problem if you can help. When the cells are filled from a userform, they are entered as text. Is there a way to make the userform convert them to n umbers?
Thanks,
Jim
 
Upvote 0
Are they coming from a textbox or something in the userform?
And do you want them entered as the actual formulas, or as static values of what the
formulas would return?

Also, can we see the code you're using to enter them?
 
Upvote 0
Again, can we see the code you're currently using for your commandbutton?

When I call up a userform with a combo & textbox I can have a list of formulas in the
ListFillRange for the combobox - entered like so: '=COUNT(Sheet1!A:A) - and then type
a formula into the textbox - like so: =Sum(Sheet1!A:A) - and with the following code:
Code:
Private Sub CommandButton1_Click()
Sheets("Sheet2").[B1].Formula = ComboBox1.Text
Sheets("Sheet2").[C1].Formula = TextBox1.Text
End Sub
it puts the live formulas into the ranges specified.

Is this what you're trying to do?
If not then can you explain further?
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,497
Members
448,967
Latest member
visheshkotha

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