+ Reply to Thread
Results 1 to 7 of 7

How to insert a formula in a cell using vba

  1. #1
    Registered User
    Join Date
    05-25-2018
    Location
    Mumbai, India
    MS-Off Ver
    2013
    Posts
    14

    How to insert a formula in a cell using vba

    Dear Sir

    How to insert a formula in a cell using vba
    the formula is
    =SUM(SIGN(FREQUENCY(IF(G5:G649>0,MATCH(B5:B649,B5:B649,0)),ROW(B5:B649)-ROW(B5)+1)))

    but I have substitute the last cell G649, B649 every time with new cell number of G & B every where in the formula

    G5 & B5 remains same in the formula
    Last edited by SamManik; 05-27-2018 at 09:46 AM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: How to insert a formula in a cell using vba

    Quote Originally Posted by SamManik View Post
    I have substitute the last cell G649, B649 every time with new cell number of G & B every where in the formula
    substituted them with what?

    What does your current code look like?
    What cell does this formula go into?
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Contributor
    Join Date
    12-27-2012
    Location
    cebu, Philippines
    MS-Off Ver
    Excel 2016
    Posts
    210

    Re: How to insert a formula in a cell using vba

    if you use that as a string and put qoutation marks, it would do too...
    example,

    this would put that formula you have into cell A1
    Please Login or Register  to view this content.
    just take note. this is fixed. if you need the formula to be referenced into multiple cells like when you drag a formula across cells where the range becomes dynamic, this method i showed you will need to be modified a bit...
    don't worry, there's a lot of people that are far more confused than you
    but if you liked what i suggested. Click for me the "Add Reputation" - that way, we'd be both happy.

  4. #4
    Registered User
    Join Date
    05-25-2018
    Location
    Mumbai, India
    MS-Off Ver
    2013
    Posts
    14

    Re: How to insert a formula in a cell using vba

    I have not coded yet
    The formula is to be inserted in O5
    Like G649 with G751 & B649 with B751 Or G841 and B841
    the cell number in "G649" & "B649" changes in other wookbook

  5. #5
    Registered User
    Join Date
    05-25-2018
    Location
    Mumbai, India
    MS-Off Ver
    2013
    Posts
    14

    Re: How to insert a formula in a cell using vba

    The cell number is user input and should be automatically substituted by the code

  6. #6
    Registered User
    Join Date
    05-25-2018
    Location
    Mumbai, India
    MS-Off Ver
    2013
    Posts
    14

    Re: How to insert a formula in a cell using vba

    range("O5").formulaarray = (array formula) solved the problem

  7. #7
    Registered User
    Join Date
    05-25-2018
    Location
    Mumbai, India
    MS-Off Ver
    2013
    Posts
    14

    Re: How to insert a formula in a cell using vba

    the thread is SOLVED, I do not the way to say it in title

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Formula to insert future date in cell, if specific information placed in other cell
    By JeninQC in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-17-2018, 11:06 AM
  2. Insert copied cell which having formula and merged cell by using command button
    By eltigre in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-20-2017, 12:50 AM
  3. Formula to insert text in a cell based on the date range of another cell
    By MTC2016 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-23-2016, 09:36 AM
  4. lock and insert formula in a cell based on selection of text in another cell
    By alirazafazal in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-01-2014, 06:08 AM
  5. Find cell with value from a column and insert formula in the cell to its left
    By konata in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-18-2014, 05:11 AM
  6. Replies: 5
    Last Post: 05-07-2013, 08:34 AM
  7. Auto-Insert Adjacent Cell Contents to Cell Chosen by LARGE Formula
    By Aravisea in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-23-2009, 02:50 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1