+ Reply to Thread
Results 1 to 11 of 11

Convert formula to VBA code without viewing the formula in Cell

  1. #1
    Registered User
    Join Date
    04-28-2015
    Location
    bangalore
    MS-Off Ver
    2013
    Posts
    56

    Convert formula to VBA code without viewing the formula in Cell

    Hello All,

    I need help here, I have a worksheet which contains project details, I have calculated percentages in excel formula, each time we are entering the Baseline amount i want to copy the formula and paste for next cell.

    Now I don't want this i need to automate like once we entered the baseline in cell E:E amount its automatically calculate the Pricing % in cell I:I.

    The formula is E:E in baseline and % Pricing in I:I column ( Formula is Actual amount ( Cell G:G / Baseline E:E)

    Kindly do the needful.

    Regards
    Kumarpk
    Last edited by KumarPK; 10-20-2016 at 11:16 PM. Reason: deleted some words
    With Regards,
    KumarPK

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,895

    Re: Convert formula to VBA code without viewing the formula in Cell

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Convert formula to VBA code without viewing the formula in Cell

    Something like this in the sheet module:
    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 10-21-2016 at 02:46 AM. Reason: Correction, thanks bakerman2
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  4. #4
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Convert formula to VBA code without viewing the formula in Cell

    @ Jerry

    Isn't it supposed to be?
    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  5. #5
    Registered User
    Join Date
    04-28-2015
    Location
    bangalore
    MS-Off Ver
    2013
    Posts
    56

    Re: Convert formula to VBA code without viewing the formula in Cell

    Hi Jerry & JB,

    Thank u so much for your valuable reply, but its not working on my sheet.

    I have attached the sample file for your reference.

    Kindly do the needful .

    Regards
    KumarPK
    Attached Files Attached Files

  6. #6
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Convert formula to VBA code without viewing the formula in Cell

    Put next code in the sheetmodule of Sheet1.

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    04-28-2015
    Location
    bangalore
    MS-Off Ver
    2013
    Posts
    56

    Re: Convert formula to VBA code without viewing the formula in Cell

    Hi Bekerman,

    I just wondering if I put in sheetmodule of Sheet1 still its not working..

    I have attached the file, can u please try from your side once...


    Please let me know if I did something wrong...?


    Regards
    KumarPK
    Attached Files Attached Files

  8. #8
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Convert formula to VBA code without viewing the formula in Cell

    What isn't working for you? Entering a value in column E gives me calculation in column I same row.

  9. #9
    Registered User
    Join Date
    04-28-2015
    Location
    bangalore
    MS-Off Ver
    2013
    Posts
    56

    Re: Convert formula to VBA code without viewing the formula in Cell

    Hi Bakerman, Good afternoon,

    Sorry for the inconvenience, I have checked again still its not working. Please find attached sample document. Let me know if I did something wrong.

    Regards
    Kumar Pk
    Attached Files Attached Files

  10. #10
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Convert formula to VBA code without viewing the formula in Cell

    Put the code in the sheetmodule of Sheet1, NOT in ThisWorkbook.

  11. #11
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Convert formula to VBA code without viewing the formula in Cell

    You placed the code in Thisworkbook - General. Right click on the sheet tab - select View code. That's where the code should have been.
    Attached Files Attached Files

+ 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] Convert Formula to VBA Formula code
    By SBBmaster09 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-26-2016, 12:01 AM
  2. Convert cell formula to VBA code
    By cmb80 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-02-2015, 05:10 AM
  3. Viewing formula in a cell when I select it
    By HannahLeyden in forum Excel General
    Replies: 8
    Last Post: 09-10-2014, 06:33 AM
  4. Convert Cell Formula to Convert Text to VBA Code
    By PY_ in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-08-2014, 05:51 PM
  5. Formula as text in cell -> convert to formula result
    By AHFoddeR in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-12-2013, 02:00 AM
  6. [SOLVED] Convert Cell Formula to Code - Compile Error
    By VBblindman in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-27-2012, 03:50 PM
  7. Condition Formatting - Viewing CF formula at each cell
    By rwgrietveld in forum Excel General
    Replies: 4
    Last Post: 01-06-2010, 03:33 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