+ Reply to Thread
Results 1 to 12 of 12

Macro to paste formula in colK after a macro executed

  1. #1
    Registered User
    Join Date
    04-15-2008
    Location
    Tamil Nadu, India.
    MS-Off Ver
    Microsoft Office 2016
    Posts
    584

    Macro to paste formula in colK after a macro executed

    Dear Friends,
    In a worksheet around more than 3000 rows are there. Columns A:J are filled with data.
    After deleting rows based certain conditions, the number of rows are reduced to around 500.

    Now, in column K, I would like to apply a formula like, =sum(a2,d2,g2) in all such existing 500 rows.

    Thanks in advance.

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,863

    Re: Macro to paste formula in colK after a macro executed

    so you probably know your last row
    if not find it (may be like:
    Please Login or Register  to view this content.
    The main task (filling with formula) could be:
    Please Login or Register  to view this content.
    Best Regards,

    Kaper

  3. #3
    Registered User
    Join Date
    04-15-2008
    Location
    Tamil Nadu, India.
    MS-Off Ver
    Microsoft Office 2016
    Posts
    584

    Re: Macro to paste formula in colK after a macro executed

    Dear Kaper Sir,

    I do not know what is wrong in Filling Down the applied formula.

    Please Login or Register  to view this content.
    The problem I am facing is:

    When executed, the output by macro is:
    Please Login or Register  to view this content.
    Whereas the output should be:
    Please Login or Register  to view this content.
    (i.e. "MyLRow is not applied as absolute reference").
    Last edited by acsishere; 10-19-2017 at 08:46 AM.
    Good friends are hard to find, harder to leave, and impossible to forget.

    acsishere.

  4. #4
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,863

    Re: Macro to paste formula in colK after a macro executed

    But ... result of these two:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    is exactly the same. Difference between relative/absolute/mixed addressing is important only on the stage of copying formulas. Once formula is in a cell, it is exactly the same if you use:
    sum(A1:C1), or sum(A$1:C$1), or anything else, like $A$1:C1
    At the moment of formula calculation it in all above cases sums values from cells A1:C1

  5. #5
    Registered User
    Join Date
    04-15-2008
    Location
    Tamil Nadu, India.
    MS-Off Ver
    Microsoft Office 2016
    Posts
    584

    Re: Macro to paste formula in colK after a macro executed

    Then, if the formula is filled-down, the last row value is increasing by one.
    i.e. in row 3, it is D22;
    in row 4, it is D23;
    in row 5, it is D24;. and so on.

    How to make it right & fix it? Please help me.
    Last edited by acsishere; 10-19-2017 at 01:25 PM.

  6. #6
    Registered User
    Join Date
    04-15-2008
    Location
    Tamil Nadu, India.
    MS-Off Ver
    Microsoft Office 2016
    Posts
    584

    Re: Macro to paste formula in colK after a macro executed

    Sir, please let me know what is wrong in this code?: (When run, in next row the value of lastrow [MyLRow] is increasing by one (like in row 3, it is D22; in row 4, it is D23; in row 5, it is D24;. and so on.)

    Please Login or Register  to view this content.
    Last edited by acsishere; 10-19-2017 at 02:52 PM.

  7. #7
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Macro to paste formula in colK after a macro executed

    I do not understand what this formula is supposed to do.


    Please Login or Register  to view this content.
    Last edited by mehmetcik; 10-19-2017 at 02:59 PM.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  8. #8
    Registered User
    Join Date
    04-15-2008
    Location
    Tamil Nadu, India.
    MS-Off Ver
    Microsoft Office 2016
    Posts
    584

    Re: Macro to paste formula in colK after a macro executed

    Sir, The formula returns "rank" based on certain groups. The macro given by you is copied in a sample sheet and attached.
    Same result. Unable to understand what is the problem. Please check it Sir.
    Attached Files Attached Files
    Last edited by acsishere; 10-19-2017 at 03:10 PM.

  9. #9
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Macro to paste formula in colK after a macro executed

    As a guess put this into J2 and fill down.

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Why not manually type the results that you expect in column J to give us a hint at what you are trying to do.

  10. #10
    Registered User
    Join Date
    04-15-2008
    Location
    Tamil Nadu, India.
    MS-Off Ver
    Microsoft Office 2016
    Posts
    584
    Sir, I have mentioned the sample output in the attached file (along with my previous reply) file name query92.xlsm.
    Request your kind perusal, sir.
    Last edited by acsishere; 10-19-2017 at 11:01 PM.

  11. #11
    Registered User
    Join Date
    04-15-2008
    Location
    Tamil Nadu, India.
    MS-Off Ver
    Microsoft Office 2016
    Posts
    584

    Re: Macro to paste formula in colK after a macro executed

    Any help, pl.

  12. #12
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,282

    Re: Macro to paste formula in colK after a macro executed

    How about this ?

    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.

+ 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. Macro executed within one tab
    By toplisek in forum Excel General
    Replies: 2
    Last Post: 07-03-2015, 04:49 AM
  2. 400 - error when macro executed
    By dantray02 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 01-10-2014, 09:10 AM
  3. Need macro help restricting when it is executed
    By graduate106 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 05-08-2013, 11:00 AM
  4. Don't open the VB Editor when a macro is executed
    By rajusampathirao in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-21-2008, 06:55 AM
  5. [SOLVED] Help with summation after macro executed
    By derekvho@gmail.com in forum Excel General
    Replies: 7
    Last Post: 04-19-2006, 03:10 PM
  6. Starting a Macro when Command is Executed?
    By Losse in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-13-2005, 11:05 AM

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