How to insert a formula in a worksheet thorugh userform

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

0
shuvrobasu (10)
3/14/2007 11:40:37 AM
excel 39879 articles. 2 followers. Follow

1 Replies
294 Views

Similar Articles

[PageSpeed] 36

On Mar 14, 4:40 pm, "MovieFan" <shuvrob...@gmail.com> wrote:
> 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 "+".!!!!!

0
shuvrobasu (10)
3/14/2007 1:06:19 PM
Reply:

Similar Artilces:

Click in cell w/ formula and get colors in referenced cells
Hi, When you click in a cell with a formula, Excel will then put color around the cells that are referenced. Somehow I turned that feature off. Now I do not get colors in th other cells. Where is that option to turn it back on???? I've looke and looked but I just can't find that option. Thanks for the help -- albea ----------------------------------------------------------------------- albean's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=2875 View this thread: http://www.excelforum.com/showthread.php?threadid=48436 ...

monthly budget/check registry spreadsheet formula
I'm working on a monthly budget/check registry spreadsheet. What I want to do is have the check register link to the allowed balances in the monthly budget. I have two fields in my monthly budget for each item. A projected cost and actual cost. I want to link entries in the check registry to the actual cost of the fields in the monthly budget. I plan to use account numbers to link these fields to each other. For example . . . Say I buy groceries for $50. When I enter this into the check registry I enter all the necessary information along with an account number that links this tra...

Help Creating A Formula #2
I need to make a formula for alook up. The first spreadsheet i inventory, the second one is pg 103 strapping. I want to enter the fee and inches for pg 103 on the inventory and have it look up the feet an inches on strapping chart and enter the appropriate gallons in column Attachment filename: p & g 101 strapping.zip Download attachment: http://www.excelforum.com/attachment.php?postid=50210 -- Message posted from http://www.ExcelForum.com ...

Time duration formula
I would like to know the formula to work out my employees employment duration, from a given start date to the current day. many thanks Take a look at DATEDIF. Explained at http://www.cpearson.com/excel/datedif.htm -- HTH RP (remove nothere from the email address if mailing direct) "Ska" <Ska@discussions.microsoft.com> wrote in message news:B10818AE-1CAD-4CE5-BDED-BC0DDC96C876@microsoft.com... > I would like to know the formula to work out my employees employment > duration, from a given start date to the current day. > > many thanks Thanks Bob, I have us...

Excel formula help #4
Hello! Can somone help me with this formula 2004:21-0-1-1-11 in this cell i wan't to get out "21" 2005:2-0-0-0-1 in this cell i wan't to get out "2" My result from the formula is "-21" and ":2-" is there a formula that i can use on both and get the result "21" and "2"? I want to add the together at the end and get the result "23" but with : and - i only get error. -- johhny ------------------------------------------------------------------------ johhny's Profile: http://www.excelforum.com/member.php?act...

CONCATENATE text to create a formula to be evaluated
Hi, I am wanting to concatenate a set of text to create a formula. I have done so below. =CONCATENATE("=MAX('",O1,"'!A3:A65536)") The result is: =MAX('2009'!A3:A65536) ....but it treats this as a text string when I try to use INDIRECT Cell O1 contains the year minus 1. In this case O1 = 2009. All of my worksheets are named as a year e.g. 2007....2008....2009...2010. I am entering this on sheet 2010. Now the real question: How do I make another cell evaluate this string as an actual formula and spit out the highest number for ...

text in formula
Help!!! Is there a way to have a formula where a cell with text is in it, but it is not included in the formula. Like I have a random cell that appears sometimes within the range but because it is text and I do not want to include it in the formula. Is there a certain "symbol" that could be used? HELP!! Hi maureen, It depends on what the actual formula is, but *some* functions ignore text entries. You could use the ISNUMBER function to include only those entries that are numbers. Post your formula for a more detailed reply. Biff >-----Original Message----- >Help...

can not insert a mail model in a compaign mail activity ?
Hello, When I am trying to send a simple mail, I can insert an email template. but when I plan a compaign based on mailing I can't make an email based on template ... So what what should I do to enable this functionality knowing that it's very intersting ability in a CRM Thanks in advance ...

need formula help
I'm trying to have a formula do 3 scenerios in one cell and have a partial formula working: IF(AND(G39>30, G39<=7),3000) which equates to if cell G39 is greater than 0 and less than or equal to 7 use 3000. I would like to continue the formula that if G39 is greater than 7 and less than 14 use 5000 and if G39 is greater than 14 use 7500. How can I do this? Hi, =IF(AND(G39>0, G39<=7),3000,IF(AND(G39>7, G39<=14),5000,if(G39>14,7500))) "tom" wrote: > I'm trying to have a formula do 3 scenerios in one cell and have a partial > form...

Formula Help #66
I need help with a formula. I can't figure out how to calculate for missing number. '05 we sold x units, I know we had a X% increase over '04 so what wa the '04 sales? Column A = '05 Columb B = '04 Column C = % increas -- bab ----------------------------------------------------------------------- babz's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=2781 View this thread: http://www.excelforum.com/showthread.php?threadid=49307 '04 sales = '05 sales / 1.X% increase Vaya con Dios, Chuck, CABGx3 "babz" wrote: >...

Copying formulas to another worksheet
Can anyone please help me, I am trying to copy a formula =(sump1:p3) from one worksheet into a new worksheet. When I go to paste the formula the only thing that comes up is =SUM(#REF!). Can I even copy and paste a formula from one worksheet into a new worksheet? and if so how? Thanks When you paste a formula it relatively changes the cell references to suit where you have pasted it to. EG. If you pasted =sum(P1:P3) from cell P4 to cell B4 it would change to =sum(B1:B3). However, if you pasted it to cell B2 it could not reasonably change the references. If you are pasting because you...

Creating Formula with Embedded Variable ID
I need to create a single formula for my workbook that references cells from various tabs (over 20) in another workbook. I want to copy this formula into multiple tabs within my workbook. My workbook and the external workbook have the same number of and identically named tabs. I want to embed a variable into the formula that will take on the name of the tab that the formula is copied to. I imagine the formula would look something like this: ='K:\Sales Reports\[Ohio Team, Mar-21-2004.xls]variable_identifying_the_tab_goes_here'!D1 I know I can use the following formula to derive th...

Formula to reference another worksheet, locate data, then record i
Hi All, It has been over 10 years since I did my Excel studies and I've unfortunately forgotten everything I haven't used regularly. My office has recently upgraded to Office 2007 (upgrade not being the descriptor I'd have chosen!) and I'm struggling with Excel. I've found my way around most issues, but I'm REALLY stuck now and suffering Friday-itis on top of it all! Essentially I have a multi-sheet workbook for my debtors ledger. Each page has separate columns for the customer numbers, names, total debts in each age range (7 days, 14 days etc), totals and lastl...

Amount in Words Complete Right Formula
give me complete formula See http://www.xldynamic.com/source/xld.xlFAQ0004.html -- HTH Bob Phillips (replace xxxx in the email address with gmail if mailing direct) "Naveed" <Naveed@discussions.microsoft.com> wrote in message news:29B7C0D6-1DED-4321-B1EB-CA6DDCE73852@microsoft.com... > give me complete formula > ...

Insert a graphic in a cell
I'd like to be able to enbed a logo in a cell. Not possible. Graphic objects reside on the drawing layer "above" the cells. Cells can contain formulae or values only. Workaround. Insert your graphic, and size it so that it exactly covers the cell. Right-click it, choosing Format Picture. In the Properties tab of the Format Picture dialog, choose the Move and Size with cells radio button. In article <F253C07B-E71A-445E-B612-0189187A09D9@microsoft.com>, Pete_Escher fan <Pete_Escher fan@discussions.microsoft.com> wrote: > I'd like to be able to enbed a...

How to reference workbook name in hyperlink formula?
In order to simplify the maintenance of workbook formulas I need to reference workbook name in hyperlink formula =[myWorkbok.xls]mySheet!$E4 in this way =[A1]mySheet!$E4 given the file name stored in cell A1 Cell A1 : myWorkbook How do I write the formula to make it work? Will it work even if the referenced workbook is closed? Regards Frank Krogh The function you'd want to use is =indirect(). But =indirect() won't work if the sending file is closed. Laurent Longre has an addin (morefunc.xll) at: http://xcell05.free.fr/ or http://xcell05.free.fr/morefunc/english/index.htm ...

Sum of a cell in all worksheets?
I usually just use the search here and quickly find what I need, but can't seem to get it work this morning I am trying to get a sum of a certain cell in all the sheets in workbook. For example of what I mean, Sum(all worksheets, d64). Ca someone possibly help me out Thanks Michae Hi Michael, Look up 3D in your Excel Help. Surely you do not want to include the same sheet. if sheet2 is your second sheet tab and "sheet 24" is the last tab. =SUM(sheet2:'sheet 24'!C14) --- HTH, David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001] My Excel Pages: htt...

Creating navigation buttons on a worksheet
Hi I'm trying to link togethor different pages on excel so i can navigate to them from each page. Also does anyone know how to create a drop down menu in excel? Many Thanks in advance Ryan Maybe by using a hyperlink: Insert|hyperlink or using the =hyperlink() worksheet function: David McRitchie posted this and it might help you: =HYPERLINK("#"&CELL("address",C5),C5) =HYPERLINK("#"&CELL("address",sheetone!C5),sheetone!C5) =HYPERLINK("#"&CELL("address",'sheet two'!C5),'sheet two'!C5) ryan_...

Error sending Excel worksheet as an attachment
If anyone can give a hand in this that would be awesome. One of our users in this office is unable to send and Excel 2000 worksheet as an attachment when selecting File > send to > Mail Recipient (as Attachment). She can send to Mail Recipient just fine (in the body of the e- mail)... and is she just right clicks the file and sends to recipient it sends fine as an attachment... she only can't send it this one way (as above). She gets the Outlook error: "The action could not be completed" and when she clicks OK to that error she gets the Excel error: "Genera...

vbscript insert into access 2003 database with two different table
I am trying to insert data collected by WMI. Here is the script On Error Resume Next Const HKEY_CURRENT_USER = &H80000001 Const HKEY_LOCAL_MACHINE = &H80000002 Const ForReading = 1 'Create FSO Set objFSO = CreateObject("Scripting.FileSystemObject") 'Create an environment for the script to work Set wshshell = WScript.CreateObject("WScript.Shell") 'Connection to the database Set cnn = CreateObject("ADODB.Connection") 'Connection to a Recordset Set objRecordSet = CreateObject("ADODB.Recordset") 'Opens the Database ...

Creating Purchase order worksheets in HQ through rules
I would like put some code in a web service in order to create a purchase order work sheet. Could I access to work sheets logic using qsrules to construct a worksheet? I looking for a method like QSRULES.CreatePOWorkSheet Thank you Oscar ...

extracting numbers from a text field and applying formula
here's my question... i have a cell that has a text field of this type: '9-19' (a-b) I want to create a formula that will subtract 19-9 (b-a) and return the result as a number// can anyone help?! is this even doable? I'd really appreciate it! PS also, i'm very fairly new at excel so a detailed response with th formula would really help! ALe ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com Try: =MID(A1,FIND("-",A1)+1,99)-LEFT(A1,FIND("...

Auto insert of date
I'm trying to input some datas using preparedStatement and among those coiumns one column is of type "smalldatetime" i wish to input the current date and time at which i execute this query, how can i achieve this in JDBC or what is the sql query for this. I'm not sure if we're talking JET SQL or T-SQL or something else here? In JET SQL you want the Date() function, something like ... INSERT INTO Table1 ( TestDate ) SELECT Date() AS Expr1; If you're using T-SQL you want the GETDATE() function, something like ... INSERT INTO dbo.Table1 (Test...

Formula Not Working Properly
I have the formula below and have tried copying it down column in macro. It will calculate the first cell "Q2" properly, but copies the same calculation from Q2 to all other cells. If I click in the formula and then the check mark to the left of formula, it calculates properly in the cell. How can I make it calculate properly from the macro? Also the range will change with each import to the worksheet the macro is applied to. How can I write the macro to apply to all cells in column Q where there is data in other columns in formula? Range("Q2").Sel...

What is the best way to Write this Formula
THank you to all that have helped and to who will help, i greatly appreciate it. Here is my question. I have four columns of data:b is OPEN, C is HIGH, D is LOW and D is CLOSE. I then wrote an =if(and)) statement with about six logical steps to come up with the words "BUY" and "SELL" in columns f and g respectfully. Then in column H I wrote a buy stop formula which is =if(f2="BUY",e2-6.00,""). Worked great got my new number now what I need to write is and this is the hard part IF at any time that the LOW(column d) from that period on until th...