+ Reply to Thread
Results 1 to 5 of 5

Dynamic formulas insertion with VBA

  1. #1
    Registered User
    Join Date
    04-25-2013
    Location
    Shanghai
    MS-Off Ver
    Excel 2007
    Posts
    10

    Dynamic formulas insertion with VBA

    Hello every body,

    I have an excel file automatically updated with new rows every days. (from column A to G). I added two columns (H and I) and I would like to insert some formulas in these columns according to the number of rows.

    For example: If lines from 1 to 20 are used, the formulas in column H and I should be activate from line 1 to 20 as well.

    Anyone to help me ?

    THank you very much

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: Dynamic formulas insertion with VBA

    Please attach a sample workbook with enough data to make it clear what is needed. 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 demonstrated, mock them up manually if needed. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

    Note: Please don't attach documents containing confidential data like (address, telephone, ID#s, etc.).


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Registered User
    Join Date
    04-25-2013
    Location
    Shanghai
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Dynamic formulas insertion with VBA

    Actually, I just want to insert a formula in cell B1 if there is some data in cell A1. Nothing very difficult. But I want to do this as long as there are data in column A. It is a dynamic incrementation with VBA. Maybe the code :

    Dim lastRow As Long


    lastRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row

    should be helpful to indicate how many rows must be fullfill with formulas.

  4. #4
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: Dynamic formulas insertion with VBA

    Try this :

    Please Login or Register  to view this content.
    Please click the * below if this helps
    Please click the * below if this helps

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,178

    Re: Dynamic formulas insertion with VBA

    Please Login or Register  to view this content.

    Note: your formula would be exactly as you would type it in the cell in row 2 EXCEPT that you need to double any quotes. For example:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    would be:
    Formula: copy to clipboard
    Please Login or Register  to view this content.




    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


+ 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] VBA to enter various formulas every 10 rows and show dynamic formulas not values
    By faby2203 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-04-2013, 07:05 AM
  2. Replies: 0
    Last Post: 08-13-2012, 11:17 AM
  3. Can't combine insertion of text into VBA code for Dynamic Worksheet names
    By Fnutt in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-07-2010, 10:34 AM
  4. Dynamic Formulas and Sheet Insertion
    By nschmoyer in forum Excel General
    Replies: 4
    Last Post: 04-28-2009, 05:53 PM
  5. Replies: 0
    Last Post: 05-02-2006, 07:55 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