+ Reply to Thread
Results 1 to 12 of 12

I want to copy down formula present in a row till it meets a certain condition. (VBA)

  1. #1
    Registered User
    Join Date
    03-03-2016
    Location
    india
    MS-Off Ver
    Mac office 16
    Posts
    5

    I want to copy down formula present in a row till it meets a certain condition. (VBA)

    Problem.jpg

    Here in the attached image you can find A3:D3 has the formulas. Each time the row is filled down the wallet size will get reduced. I want to write a macro to perform this operation to fill down cells till the wallet size goes below 100. Thanks in advance

  2. #2
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: I want to copy down formula present in a row till it meets a certain condition. (VBA)

    You should post a sample workbook, instead just a screenshot.

    Find it why, in the forum rules page :
    http://www.excelforum.com/forum-rule...rum-rules.html

    and search for keyword :
    Want to get your question answered quickly?
    Post a WORKBOOK


    The code you expected is something like this :
    Please Login or Register  to view this content.

  3. #3
    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,623

    Re: I want to copy down formula present in a row till it meets a certain condition. (VBA)

    Why macros? Use formulas and copy down with excess

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

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

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

    and copy down
    I3:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    and copy down
    Best Regards,

    Kaper

  4. #4
    Registered User
    Join Date
    03-03-2016
    Location
    india
    MS-Off Ver
    Mac office 16
    Posts
    5

    Re: I want to copy down formula present in a row till it meets a certain condition. (VBA)

    THanks for the quick help karedog and kaper.

    @karedog

    I have copied the script to the sheet but it isnt working as i wanted. And can you breakdown the script. i am a newbie here. Thanks.

    And @kaper there is some problem in attaching worksheets, idk :/

  5. #5
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: I want to copy down formula present in a row till it meets a certain condition. (VBA)

    Try the attached file, is this not what you expected ?
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    03-03-2016
    Location
    india
    MS-Off Ver
    Mac office 16
    Posts
    5

    Red face Re: I want to copy down formula present in a row till it meets a certain condition. (VBA)

    WOw!! this is exactly what i asked for.

    Brilliant work.

    Actually, It takes time to calculate the result i wasnt waiting. Thank u so much

  7. #7
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: I want to copy down formula present in a row till it meets a certain condition. (VBA)

    You are welcome, and thanks for the reputation point given.


    Regards

  8. #8
    Registered User
    Join Date
    03-03-2016
    Location
    india
    MS-Off Ver
    Mac office 16
    Posts
    5

    Re: I want to copy down formula present in a row till it meets a certain condition. (VBA)

    Hey karedog,

    so one more question, here basically in the file you have attached i see it fills down till the end of the sheet and then it removes the cells which are above 1000. How can make this filling stop once the match 1000 is found instead of filling the whole worksheet. because I am planning to use this technique to a different sheet which uses bit complex formulas which actually takes a really long time to calculate. THanks in advance.

  9. #9
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: I want to copy down formula present in a row till it meets a certain condition. (VBA)

    I believe that will make the calculation slower, instead faster. If we do put formulas cell by cell then examine whether the condition is already met, then there are excessive overhead call between vba (the macro) and the range object, if you want to get the result as fast as possible, you should use Excel's solver feature instead, but solver cannot display the calculation result step by step, as the formulas do.

  10. #10
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: I want to copy down formula present in a row till it meets a certain condition. (VBA)

    Adding a comments to karedog's last post.

    Running solver with a macro has not been possible in some Mac version of Excel because

    There is a serious problem using Solver for Excel in Office 2011 when it is called from vba. Because Solver is a separate application, control must be transferred from Excel to Solver, and this control does not occur until after vba has terminated. This means that any processing that occurs in the vba program after the call to SolverSolve will be completed before Solver has done its task.
    The OP uses Mac Office 16 so perhaps the problem has been fixed now but this should be tested first i.e. running solver in a macro.

    Alf

  11. #11
    Registered User
    Join Date
    03-03-2016
    Location
    india
    MS-Off Ver
    Mac office 16
    Posts
    5

    Re: I want to copy down formula present in a row till it meets a certain condition. (VBA)

    Thanks a lot guys. that helps

  12. #12
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: I want to copy down formula present in a row till it meets a certain condition. (VBA)

    @Alf: Thanks for the nice info.

    @balajidream: You are welcome, glad to help.


    Regards

+ 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] Copy Formula Down Till No Data In Cell
    By scarlettw123 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-21-2015, 12:43 PM
  2. Copy formula till a certain line number (7731)
    By WendyvdV in forum Excel General
    Replies: 3
    Last Post: 01-14-2015, 11:08 AM
  3. Copy data from one worksheet to another worksheet ( if meets condition) ????
    By Rmag in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-02-2014, 06:48 PM
  4. help need to copy and delete rows if condition meets
    By punar in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-16-2013, 03:38 AM
  5. [SOLVED] Copy Cells Where Another Cell On Same Row Meets Condition
    By marshak in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-25-2013, 08:36 PM
  6. Copy and paste formula till the last row
    By vijanand1279 in forum Excel General
    Replies: 9
    Last Post: 01-05-2011, 01:26 PM
  7. Copy For Cell Values Present and not Formulas Present
    By bdb1974 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-11-2009, 12:10 PM

Tags for this Thread

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