Need a Macro to enter formula

vijayamani1987

New Member
Joined
Mar 16, 2014
Messages
32
Hi people,

I am using a user defined function formula in my excel sheet. The formula is


PlaceBO = (Exch, TrdSym, Trans, Qty, LmtPrice, SqOffValue, StoplossValue, TrailPoints, OrdType, TrgPrice, cTag)


I am using this for trading. The problem is I am manually editing the formula every time. I tried CONCATENATE formula which gives value as follows,


PlaceBO("NSE","sail","BUY",100,600,2,2,0)


Problem is again I needed to double click that cell and enter symbol "=" at the beginning of the formula. How can I make it through VBA. Please through some light. Thank you
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
.
Presuming for this example, you want the formula to go in Sheet #1 / Cell B8:

Code:
Option Explicit


Sub entForm()
Sheets("Sheet1").Range("B8").Value = "=PlaceBO(""NSE"",""sail"",""BUY"",100,600,2,2,0)"
End Sub

Note there is a quotation marks at the beginning and end of the formula. Also, if there are quotation marks required within the formula itself, there must be an additional
quotation mark next to it. When the formula is pasted into the cell, the extra quotation marks are not transferred to the cell.

Also, there is no way for me to know if your formula actually works. The example is based off what you have posted.
 
Upvote 0
Hi Logit,

Thank you. It's working and placing orders. But I need it work in other way. Perhaps I didn't explained my problem clearly. Below is the actual sheet.
[TABLE="width: 1371"]
<colgroup><col><col><col><col><col><col><col span="2"><col><col><col><col></colgroup><tbody>[TR]
[TD][/TD]
[TD][/TD]
[TD][TABLE="width: 1371"]
<colgroup><col><col><col><col><col><col><col span="2"><col><col><col><col></colgroup><tbody>[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[TD]H[/TD]
[TD]I[/TD]
[TD]J[/TD]
[TD][/TD]
[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/TD]
[TD]BUY[/TD]
[TD]80[/TD]
[TD]201[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]=PlaceBO("NSE","TATAGLOBAL","BUY",80,201,1,0)[/TD]
[TD] [/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]8[/TD]
[TD]NSE[/TD]
[TD]WIPRO[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]In your code the formula contains exact values. But the values in columns D:H keep changing. And so the values in column I. What I am currently doing is whenever a order formula appears at column "I", I will copy it manually and paste it in adjacent cell at column J. Then in that cell (in column J) I have to double click and press enter. Then only the order will pass.

Your code is passing the order. But I need it to search it in column I for orders and place it in column J.

Thanks in advance.[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,180
Members
453,021
Latest member
Justyna P

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