How to insert a formula in a worksheet thorugh userform

  • Thread starter Thread starter MovieFan
  • Start date Start date
M

MovieFan

Hi All,

I want to insert a formula in a cell in a worksheet. The formula has
two parts. The first part is a function and the second is a also a
function but it has parameters that are taken from different variables
from the userform. For eg. I use the time() function. The parameters
for time() function are stored in variables part1,part2 and part3. I
then use a string variable to store the whole formula like
frmstr = time(int(part1),int(part2),int(part3)
then I use range("A3").select
activecell.Offset(0,1).formula = "=now()" + frmstr and get a "Type
Mismatch" Error.

Can anyone tell me how to substitute the formula (which is now() +
time(x,x,x) into the required cell.

Thanks in advance.

regards
 
Hi All,

I want to insert a formula in a cell in a worksheet. The formula has
two parts. The first part is a function and the second is a also a
function but it has parameters that are taken from different variables
from the userform. For eg. I use the time() function. The parameters
for time() function are stored in variables part1,part2 and part3. I
then use a string variable to store the whole formula like
frmstr = time(int(part1),int(part2),int(part3)
then I use range("A3").select
activecell.Offset(0,1).formula = "=now()" + frmstr and get a "Type
Mismatch" Error.

Can anyone tell me how to substitute the formula (which is now() +
time(x,x,x) into the required cell.

Thanks in advance.

regards

Hi All,

I resolved it myself using the "&" ampersand instead of the addition
sign "+".!!!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top